// React基础组件
import React from 'react'
// dva 连接组件 - 连接route和model
import { connect } from 'dva'
// 引入antd的组件
import { Affix,Form, Button, Modal, Popconfirm, Table, Row, Col, Input, Select, message, Icon,Divider, Checkbox, Radio, Tooltip, Tabs, Cascader, DatePicker } from 'antd'
//导入路由组件，用于跳转等
import { Link, hashHistory } from 'dva/router'
// 导入项目全局配置文件
import config from 'config/config'
import { mapStateToProps } from 'utils/view_utils'
import styles from './gameParamsTabStyle.less'
import classnames from 'classnames/bind';
let cx = classnames.bind(styles);
import Uploader from 'widget/Upload'
import PopUpSelect from 'widget/PopUpSelectnoModal/PopUpSelect'
import { isEmpty, isArray, cloneDeep, set, get, pick, every, indexOf } from 'lodash'
import { CollapsiblePanels } from 'widget/CollapsiblePanels/index'
import moment from 'moment';
import Ueditor from '../../../../widget/Editor/Ueditor.js'
// 引入列表页组件
import ListPage from 'widget/PageTmpl/ListPage'
import { func } from 'prop-types'
const { TabPane } = Tabs;
const FormItem = Form.Item;
// const TabPane = Tabs.TabPane
// const confirm = Modal.confirm;
const InputGroup = Input.Group;
const { RangePicker } = DatePicker;
const Option = Select.Option;
const formItemLayout = {
	labelCol: { span: 4 },
	wrapperCol: { span: 19 },
};
const formItemLayoutTime = {
	labelCol: { span: 5 },
	wrapperCol: { span: 19 },
};
const formItemLayout2 = {
	labelCol: { span: 2 },
	wrapperCol: { span: 8 },
};
const formItemLayoutForTime = {
	labelCol: { span: 2 },
	wrapperCol: { span: 20 },
};
const formItemLayout3 = {
	labelCol: { span: 8 },
	wrapperCol: { span: 16 },
}
const formItemLayout4 = {
	labelCol: { span: 4 },
	wrapperCol: { span: 20 },
}
const formItemLayout5 = {
	labelCol: { span: 6 },
	wrapperCol: { span: 18 },
}
const formItemLayout6 = {
	labelCol: { span: 5 },
	wrapperCol: { span: 19 },
}
const gameParamsTabView = function ({ dispatch, model, form }) {
    
	const blockTab ={
		display:'block',
		width:'80%'
	}
    // 表单的子函数 
	const { resetFields, getFieldDecorator, validateFields, setFieldsValue } = form
	// 取出model对象，命名空间
	const { modelObj, namespace } = model
	let { area1,roleType,gameStatus,activeIndex,areaList1,clique,query,city,discityList,counselorModalObj,giftModalObj,currentStep, actionType, btnLoading, gameBaseDetail,gamePrizeWayDetail,gamePrizeSetDetail,gameHighSetDetail, areaList, estateList, isPromotePro, isSubmit, gameHighSetImgModal,tabKey,panes,prizeTabIndex,gamePrizeSetDetailList,selectItem,indeterminate,checkAll,projectData,mapAddress,rewardRange,dailyLogins,developAgents,onlineBuy,gameType,gameActivityId,dailyLoginChecked,developAgentChecked,onlineBuyChecked } = modelObj
	/*
    ==========================通用代码部分开始=============================
    */
    function tabCallback(key) {
		dispatch({ type: `${namespace}/updateStore`, payload: { tabKey: key } })
	}
	
	function prizeTabCallback(key){
		changePrizeData(key-1);
		dispatch({ type: `${namespace}/updateStore`, payload: { prizeTabIndex: key } })
		// form.resetFields();
	}

	function changePrizeData(key){
		if(gamePrizeSetDetailList.length > 0){
			if(gamePrizeSetDetailList[key]){
				if(gamePrizeSetDetailList[key].prizeImgUrls == ""){
					gamePrizeSetDetailList[key].noPrizeImgUrls = ["https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M1.png","https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M2.png","https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M4.png","https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M5.png","https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M6.png"];
					gamePrizeSetDetailList[key].prizeImgUrls = ["https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M3.png","https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M3.png","https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M3.png"];
				}
				if(gameBaseDetail.promoteStatus && gamePrizeSetDetailList[key].estateAddress.length == 0){
					gamePrizeSetDetailList[key].estateAddress = gamePrizeSetDetailList[0].estateAddress;
				}
				gamePrizeSetDetail = gamePrizeSetDetailList[key];
				if(gamePrizeSetDetail.awardType == '1'){
					giftPageProps.biz = gamePrizeSetDetail.biz;
				}else if(gamePrizeSetDetail.awardType == '2'){
					discountCouponPageProps.biz = gamePrizeSetDetail.biz;
				}
				if(gamePrizeSetDetail.rewardWay == "3"){
					counselorPageProps.biz = gamePrizeSetDetail.counselorBiz;
				}
			}else{
				// let estateAddress = [];
				// if(gameBaseDetail.promoteStatus){
				// 	estateAddress = gamePrizeSetDetailList[0].estateAddress;
				// }
				gamePrizeSetDetail = {
					awardType:"0",//奖项类型0为自定义1为商城礼品2为优惠券
					awardName:"",//自定义的奖品名称
					awardNumber:"",//奖品总库存
					useNumber:"0",//已用数量
					awardStock:"",//奖品剩余库存
					awardImgUrl:"",//自定义奖项图片
					winningRate:"100",//此奖项在总奖品中奖概率
					duration:"",//固定兑奖时间
					durationType:"1",//固定兑奖时间类型
					awardGamePlayerType:"1",//奖项玩家类型
					outerId:"",//优惠券ID
					operationHint:"",//操作提示/兑奖提示
					rewardWay:"1",//兑奖方式
					noPrizeImgUrls:["https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M1.png","https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M2.png","https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M4.png","https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M5.png","https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M6.png"],//未中奖图片数组url
					prizeImgUrls:["https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M3.png","https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M3.png","https://zysj-pro.oss-cn-shenzhen.aliyuncs.com/zysq-miniprogram/images/games/game_M3.png"],//中奖图片数组url
					startTime:"",//兑奖截止开始时间
					endTime:"",//兑奖截止结束时间
					estateAddress:[],//楼盘地址
					giftName:"",//礼品名称
					awardLevel:(key+1)+"",//奖项等级
					consolationAward:"0",//是否为安慰奖0否1是
					redeemUserNames:"",//选中的兑奖人员名称
					counselors:[],//兑奖人员ID
					gameActivityAwardId:"",//奖项设置ID（修改的时候一定要传值）
					currentItem:[],
					sort:key,
					counselorCurrentItem:[],
					redAmount:'', // 红包金额
					sendRedAccount:'', // 红包发放账户
					points:'', // 发放积分
					biz:{
						rowSelection_type:'radio',
						selectedRowKeys:[]
					},
					counselorBiz:{
						rowSelection_type:'checkbox',
						selectedRowKeys:[]
					}
				};
				if(gameBaseDetail.promoteStatus && gamePrizeSetDetail.estateAddress.length == 0){
					gamePrizeSetDetail.estateAddress = gamePrizeSetDetailList[0].estateAddress;
				}
				gamePrizeSetDetailList.push(gamePrizeSetDetail);
			}
			form.setFieldsValue({
				content: gamePrizeSetDetailList,
			});
			form.resetFields();
			dispatch({ type: `${namespace}/updateStore`, payload: { gamePrizeSetDetailList:gamePrizeSetDetailList,gamePrizeSetDetail: gamePrizeSetDetail } })
		}
	}

	function prizeEdit(targetKey, action){
		//console(targetKey)
		if(action == "add"){
			prizeAdd();
		}else if(action == "remove"){
			prizeRemove(panes,targetKey);
		}
	  }

	  //奖项排名向右移
	  function prizeRight(){
		let nowPanes = panes[prizeTabIndex-1];
		let nowList = gamePrizeSetDetailList[prizeTabIndex-1];
		let targetPanes = panes[prizeTabIndex];
		let targetList = gamePrizeSetDetailList[prizeTabIndex];

		
		if(!targetPanes || targetPanes == undefined){
			message.warn("当前奖项排名已经在最后一位");
			return false;
		}
		panes[prizeTabIndex-1] = targetPanes;
		gamePrizeSetDetailList[prizeTabIndex-1] = targetList;
		gamePrizeSetDetailList[prizeTabIndex-1].awardLevel = prizeTabIndex+"";
		gamePrizeSetDetailList[prizeTabIndex-1].sort = Number(prizeTabIndex)-1;
		panes[prizeTabIndex-1].title = prizeTabIndex+"等奖";
		panes[prizeTabIndex-1].key = prizeTabIndex+"";

		panes[prizeTabIndex] = nowPanes;
		gamePrizeSetDetailList[prizeTabIndex] = nowList;
		gamePrizeSetDetailList[prizeTabIndex].awardLevel = Number(prizeTabIndex)+1+"";
		gamePrizeSetDetailList[prizeTabIndex].sort = prizeTabIndex;
		panes[prizeTabIndex].title = Number(prizeTabIndex)+1+"等奖";
		panes[prizeTabIndex].key = Number(prizeTabIndex)+1+"";
		prizeTabIndex = Number(prizeTabIndex)+1+"";
		dispatch({ type: `${namespace}/updateStore`, payload: { panes:panes, prizeTabIndex:prizeTabIndex,gamePrizeSetDetailList:gamePrizeSetDetailList } })
		changePrizeData(prizeTabIndex-1);
	  }

	  //奖项排名向左移
	  function prizeLeft(){
		let nowPanes = panes[prizeTabIndex-1];
		let nowList = gamePrizeSetDetailList[prizeTabIndex-1];
		let targetPanes = panes[prizeTabIndex-2];
		let targetList = gamePrizeSetDetailList[prizeTabIndex-2];

		
		if(!targetPanes || targetPanes == undefined){
			message.warn("当前奖项排名已经在第一位");
			return false;
		}
		panes[prizeTabIndex-1] = targetPanes;
		gamePrizeSetDetailList[prizeTabIndex-1] = targetList;
		gamePrizeSetDetailList[prizeTabIndex-1].awardLevel = prizeTabIndex+"";
		gamePrizeSetDetailList[prizeTabIndex-1].sort = Number(prizeTabIndex)-1;
		panes[prizeTabIndex-1].title = prizeTabIndex+"等奖";
		panes[prizeTabIndex-1].key = prizeTabIndex+"";

		panes[prizeTabIndex-2] = nowPanes;
		gamePrizeSetDetailList[prizeTabIndex-2] = nowList;
		gamePrizeSetDetailList[prizeTabIndex-2].awardLevel = Number(prizeTabIndex)-1+"";
		gamePrizeSetDetailList[prizeTabIndex-2].sort = Number(prizeTabIndex)-2;
		panes[prizeTabIndex-2].title = Number(prizeTabIndex)-1+"等奖";
		panes[prizeTabIndex-2].key = Number(prizeTabIndex)-1+"";
		prizeTabIndex = Number(prizeTabIndex)-1+"";
		dispatch({ type: `${namespace}/updateStore`, payload: { panes:panes, prizeTabIndex:prizeTabIndex,gamePrizeSetDetailList:gamePrizeSetDetailList } })
		changePrizeData(prizeTabIndex-1);
	  }
	  
	  //新增奖项排名
	  function prizeAdd(){
		let {modelObj} = model
		//   老虎机
		if(modelObj.gameType && modelObj.gameType == 0){
			if(panes.length > 14) {
				message.warning('奖项最多可设置15个!')
				return
			}
		}else{
			// 其他类型游戏
			if(panes.length > 7) {
				message.warning('奖项最多可设置8个!')
				return
			}
		}
		let activeKey = `${panes.length+1}`;
		panes.push({ title: `${activeKey}等奖`, key: activeKey,closable:true,editable:true });
		dispatch({ type: `${namespace}/updateStore`, payload: { panes:panes, prizeTabIndex:activeKey } })
		changePrizeData(activeKey-1);
	  }
	  
	  //删除奖项排名
	  function prizeRemove(panes,targetKey){
		let lastIndex;
		for(let i=0;i<panes.length;i++){
			if (panes[i].key === targetKey) {
				lastIndex = i - 1;
				break;
			}
		}
		let targetPanes = panes[targetKey-1];
		let targetList = gamePrizeSetDetailList[targetKey-1];
		if((gamePrizeSetDetailList[targetKey-1].awardNumber != "") && Number(gamePrizeSetDetailList[targetKey-1].awardNumber) != Number(gamePrizeSetDetailList[targetKey-1].awardStock)){
			message.warn("该奖项已有用户中奖，无法删除！");
			return false;
		}
		panes.splice(targetKey-1,1);
		// panes = panes.filter(pane => pane.key !== targetKey);
		gamePrizeSetDetailList.splice(targetKey-1,1);
		if(gamePrizeSetDetailList[targetKey-1] && panes[targetKey-1]){
			gamePrizeSetDetailList[targetKey-1].awardLevel = targetList.awardLevel+"";
			gamePrizeSetDetailList[targetKey-1].sort = targetList.sort;
			panes[targetKey-1].title = targetPanes.title;
			panes[targetKey-1].key = targetPanes.key+"";
			for(let i=0;i<panes.length;i++){
				if(i > targetKey-1){
					panes[targetKey].title = (i+1)+"等奖";
					panes[targetKey].key = (i+1)+"";
					gamePrizeSetDetailList[targetKey].awardLevel = (i+1)+"";
					gamePrizeSetDetailList[targetKey].sort = i;
				}
			}
			if (panes.length>0) {
				if(prizeTabIndex === targetKey && (!panes[targetKey-1] || panes[targetKey-1] == undefined)){
					if (lastIndex >= 0 && targetPanes.key != '1') {
						prizeTabIndex = panes[lastIndex].key;
					} else {
						prizeTabIndex = panes[0].key;
					}
				}else{
					prizeTabIndex = targetKey+"";
				}
				
			}
		}else{
			prizeTabIndex = targetKey-1+"";
		}
		if(panes.length == 1){
			panes[0].closable = false;
		}
		dispatch({ type: `${namespace}/updateStore`, payload: { panes:panes, prizeTabIndex:prizeTabIndex,gamePrizeSetDetailList:gamePrizeSetDetailList} })
		changePrizeData(prizeTabIndex-1);
	};

    //提交
    function submit(key) {
        validateFields((err, values) => {
            if (!err) {
                dispatch({
                    type: `${namespace}/submit`,
                    payload: {key:key}
                })
            }
        });
    }
    /*
    ==========================通用代码部分结束=============================
    */

    /*
    ==========================基础设置代码开始=================================
    */
	function gameBaseInputChange(value, type, index) {
		if(type == "launchApp"){
			gameBaseDetail[type] = value;
			if(value == "2"){
				if(!gameBaseDetail.promoteStatus){
					mapAddress="";
				}
				gameBaseDetail.promoteStatus = true;
				gameBaseDetail.provinceCodes = [];
				gameBaseDetail.cityCodes = [];
				city=[];
				discityList=[];
				query.provinceCodes=[''];
				query.cityCodes=[[]];
				query.wholeCountry=false;
				gamePrizeSetDetail.estateAddress = [];
				gameBaseDetail.bannerUrl = "";
				gameBaseDetail.titleImgUrl = "";
				
				gameHighSetDetail.sponsorUnit = "美的置业集团";
				gameHighSetDetail.allowSharing = "0";
				gameHighSetDetail.assistedOpening = "0";
				gameHighSetDetail.sharingPosterShow = "0";

				gamePrizeWayDetail.participators = "0";
				gamePrizeWayDetail.startSubscriptionTime = "";
				gamePrizeWayDetail.endSubscriptionTime = "";
				gamePrizeWayDetail.startMarketingTime = "";
				gamePrizeWayDetail.endMarketingTime = "";
			}
		}else if (type == 'areaId') {
			// console.log(value)
			gameBaseDetail.province = value[0]
			gameBaseDetail.city = value[1]
			// gameBaseDetail.parentProductId = ""
			dispatch({ type: `${namespace}/getHouseArea`, payload: { province: value[0], city: value[1] } })
		} else if(type=="pushAreaId"){
			gameBaseDetail.province = value[0];
			gameBaseDetail.city = value[1];
		}else if(type == 'promoteStatus'){
			gameBaseDetail[type] = value;
			if(value){
				if(query.provinceCodes.length == 0){
					query.provinceCodes=['0'];
					query.wholeCountry = true;
				}else{
					query.wholeCountry = false;
				}
				gameBaseDetail.provinceCodes = [];
				gameBaseDetail.cityCodes = [];
				// city=[];
				// discityList=[];
				// query.cityCodes=[[]];
				// query.wholeCountry=false;
				gamePrizeSetDetail.estateAddress = [];
			}else{
				if(query.provinceCodes.length == 0){
					query.provinceCodes=['0'];
					query.wholeCountry = true;
				}else{
					query.wholeCountry = false;
				}
				gameBaseDetail.province = "";
				gameBaseDetail.provinceCode = "";
				gameBaseDetail.city = "";
				gameBaseDetail.cityCode = "";
				gameBaseDetail.projectId = "";
				gameBaseDetail.productId = "";
				mapAddress="";
				gamePrizeSetDetail.estateAddress = [];
			}
        }else if(type == 'productId'){
			if(estateList.length > 0){
				for(let i=0;i<estateList.length;i++){
					if(estateList[i].productId == value){
						gameBaseDetail.productId = value;
						gameBaseDetail.projectId = estateList[i].outerId;
						break;
					}
				}
			}
			dispatch({
				type: `${namespace}/getProductInto`,
				payload: { productId: value}
			});
			
		}
		else if( type == 'regionId'){
			let region_name = index.props.children
			gameBaseDetail.regionId = value;
			gameBaseDetail.regionName = region_name;
		}
		else {
            gameBaseDetail[type] = value
		}
		form.resetFields();
		changeState({ gameBaseDetail,query,city,discityList,mapAddress,gameHighSetDetail,gamePrizeWayDetail })

	}

	//日期改变时
	function gameBaseDateChange(m, s, type) {
		if (type == 'activeTime') {
			changeState({
				gameBaseDetail: {
					...gameBaseDetail,
					startTime: s[0],
					endTime: s[1],
				}
			})
        }

	}

	//输入字数限制
	function capture(value, num) {
		// console.log(value,num)
		if (value) {
			value = value.substr(0, num)
		}
		return value
	}

	//修改状态
	const changeState = (payload) => {
		// console.log(payload);
		dispatch({
			type: `${namespace}/updateStore`,
			payload: { ...payload }
		})
	};
	



	//动态增加form表单
    const formItems1 = query.provinceCodes && query.provinceCodes.map((k, index) => (
        <Row>
            <Col span={12}>
                <Form.Item
                    {...formItemLayout4}
                    required={false}
					key={index}
					label="活动参与范围"
                >
                    {getFieldDecorator(`provinceCodes[${index}]`, {
                        validateTrigger: ['onChange', 'onBlur'],
                        rules: [{
                            required: false,
                            whitespace: true,
                            message: "请选择或者删除此范围",
                        }],
                        initialValue: query.provinceCodes[index]
                    })(
                        <Select style={{width:'95%'}} onSelect={(value, option) => { getProvince(value, option, index) }} disabled={actionType == 'detail'} >
                        {<Select.Option value='0' key='0' disabled={!JSON.parse(clique)}>全国</Select.Option>}
                            
                            {areaList1.map((item, i) => {
                                return (
                                    <Select.Option value={item.value} key={JSON.stringify(item.children)}>{item.label}</Select.Option>
                                )
                            })}
                        </Select>
                    )}
					
                </Form.Item>
            </Col>

            {query.provinceCodes && query.provinceCodes.length > 1 && actionType != 'detail'? (
                <Col span={2}>
                    <Icon
                        className="dynamic-delete-button"
                        type="minus-circle-o"
                        disabled={query.provinceCodes.length === 1 }
                        onClick={() => remove(index)}
                    />
                </Col>
            ) : null}
			{index == 0 &&
				<Col span={2}><Tooltip title="说明：选中的城市用户才能参与抽奖游戏。"><Icon type="question-circle" className={cx('iconTip')} /></Tooltip></Col>
			}
        </Row>

    ));

      

    //增加全选
    function onCheckAllChange(y,e){
        let arr = []
        if(e.target.checked){
            city[y].forEach((item,idx)=>{
               arr.push(item.value)
            })
        }
        query.cityCodes[y] = arr
        dispatch({
            type:`${namespace}/updateStore`,
            payload:{query}
        })
        form.resetFields([`cityCodes[${y}]`])
    }
    const formItems2 = query.cityCodes && query.cityCodes.map((x, y) => (
		<div>{query.provinceCodes[y] != "0"?
        <div style={{marginLeft:'9%'}}>
            <div >
        {!query.wholeCountry && query.provinceCodes[y]>0 ?<Checkbox
                indeterminate={query.cityCodes[y]&&city[y]&&query.cityCodes[y].length!=0 &&(query.cityCodes[y].length !=  city[y].length) }
                    onChange={(e)=>onCheckAllChange(y,e)}
                checked={query.cityCodes[y]&&city[y]&&(query.cityCodes[y].length ==  city[y].length)}
            >
                全选
            </Checkbox>:null}
            </div>
            <Form.Item
                required={false}
                key={y}
            >
                {getFieldDecorator(`cityCodes[${y}]`, {
                   initialValue: query.cityCodes[y],
                })(
                    <Checkbox.Group disabled={actionType == 'detail'} style={{ width: "100%" }} onChange={(value) => getCity(value, y)}>
                      {city[y]?city[y].map(item=>{return (<Checkbox disabled={discityList.includes(item.value) || actionType == 'detail'} value={item.value}>{item.label}</Checkbox>)}):''}
                    </Checkbox.Group>
                )}
            </Form.Item>

        </div>
		:''}</div>
    ));
    const formItems = formItems1&&formItems1.map((x, y) => (
        <div key={y}>{formItems1[y]}{formItems2[y]}</div>))


    //删除form表单函数
    function remove(k) {
        query.provinceCodes = query.provinceCodes.filter((key, index) => index !== k)
        query.cityCodes = query.cityCodes.filter((key, index) => index !== k)
        let mcity = city.filter((key, index) => index !== k)
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { city:mcity, query }
        });
    }
    //增加form表单函数
    function add() {
        query.provinceCodes.push("")
        query.cityCodes.push([])
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { query }
        });
    }
    //判断当选择的全部城市是多选框的全国默认被选上，并且不可用
    function getProvince(e, option, i) {
        
        if (e == 0) {
		   query.wholeCountry = true
		   query.cityCodes = [['0']];
        } else if (e != 0) {
            query.wholeCountry = false
            query.cityCodes[i] = []
            // dispatch({
            //   type:`${namespace}/getDiscity`,
            //   payload:{pId:e}
            // })
        }
		query.provinceCodes[Number(i)] = e;
        city[i] = JSON.parse(option.key)
        form.resetFields([`cityCodes[${i}]`])
        form.resetFields([`provinceCodes[${i}]`])
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { city,  query }
        });
        form.resetFields(['useRange'])
    }
    
    //获取所选城市
    function getCity(e, i) {
		 query.cityCodes[i] = e
         //query.city
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { query }
        });
    }
    //获取所选项目的城市
    function getSelected(e, option) {
        let num=JSON.parse(option.key)
        dispatch({
            type: `${namespace}/updateStore`,
            payload: { num }
        });
	}
	

	function removeBaseImgUrl(type) {
        gameBaseDetail[type] = ''
        changeState({ gameBaseDetail })
    }

    function changeBaseImgModal(visible = false, srcs = []) {
        gameBaseImgModal.visible = visible
        gameBaseImgModal.srcs = srcs || modelObj.srcs
        changeState({ gameBaseImgModal })
    }

    //封面图改变时
    function updateBaseImageModel(value, type) {
        gameBaseDetail[type] = value
        changeState({ gameBaseDetail })
    }
    
     /*
     =============================基础设置代码结束=======================================
     */


    /*
    ==============================派奖方式代码开始======================================
    */

   function gamePrizeTabInputChange(value, type, index) {
		// console.log(e, type)
        if(type == "participators"){
			gamePrizeWayDetail[type] = value;
			form.resetFields()
            if(value == '1' || value == '3'){
                gamePrizeWayDetail.startSubscriptionTime = moment().format('YYYY-MM-DD 00:00:01');
                gamePrizeWayDetail.endSubscriptionTime = moment().add(1,"months").format('YYYY-MM-DD 23:59:59');
                gamePrizeWayDetail.startMarketingTime = '';
                gamePrizeWayDetail.endMarketingTime = '';
            }else if(value == '4'){
                gamePrizeWayDetail.startSubscriptionTime = '';
                gamePrizeWayDetail.endSubscriptionTime = '';
                gamePrizeWayDetail.startMarketingTime = moment().format('YYYY-MM-DD 00:00:01');
                gamePrizeWayDetail.endMarketingTime = moment().add(1,"months").format('YYYY-MM-DD 23:59:59');
            }else{
                gamePrizeWayDetail.startMarketingTime = '';
                gamePrizeWayDetail.endMarketingTime = '';
                gamePrizeWayDetail.startSubscriptionTime = '';
                gamePrizeWayDetail.endSubscriptionTime = '';
            }
        }
        else {
            gamePrizeWayDetail[type] = value;
        }

        changeState({ gamePrizeWayDetail })

    }


    //日期改变时
    function gamePrizeWayDateChange(m, s, type) {
        if (type == 'subscriptionTime') {
            changeState({
                gamePrizeWayDetail: {
                    ...gamePrizeWayDetail,
                    startSubscriptionTime: s[0],
                    endSubscriptionTime: s[1],
                }
            })
        }else if (type == 'marketingTime') {
            changeState({
                gamePrizeWayDetail: {
                    ...gamePrizeWayDetail,
                    startMarketingTime: s[0],
                    endMarketingTime: s[1],
                }
            })
        }

    }

    /*
    ==============================派奖方式代码结束======================================
    */


	/*
	==============================奖项设置代码开始=======================================
	*/
	const sellerTableColumn = [
		{ title: '项目名称', width: 100, dataIndex: 'productName', key: 'productId',render:(e,item)=>{
			return item.productName ||item.name
		} },
		{ title: '所属城市',width:170, dataIndex: 'city', key: 'city' ,render:(a, item, index, d, e, f)=>{
			//console.log(item)
			let arr = ['北京市','重庆','上海','天津']
			if(arr.indexOf(item.provinceName)>-1){
				return `${item.cityName}`
			  }else{
				return `${item.provinceName||''}${item.provinceName&&item.cityName&&' - '||''}${item.cityName||''}`
			  }
		  }
		},
		{
			title:'项目地址',width:200,dataIndex:'mapAddress',key:'mapAddress'
		}
	];
	
	let sellerQueryList = [
		// {name: '区域公司', type: 'select', key: 'regionId',list:addressList,notNeedAll:true},
		{ name: '省市', type: 'cascader', list: cloneDeep(areaList), key: ['province', 'city', 'county'], value: '' },
		{ name: '项目名称', type: 'text', key: 'name', value: '' },
		{ name: '', type: 'hidden', key: 'shelfStatus', value: '1' },
	];
	
	const sellerSelectedColumn = [
		{ title: '项目名称', width: 110, dataIndex: 'productName', key: 'productId' ,render:(e,item)=>{
			return  item.productName ||item.name
		}},
		{ title: '所属城市', dataIndex: 'cityName', key: 'cityName',render:(a, item, index, d, e, f)=>{
			//console.log(item)
			// console.log(item)
			let arr = ['北京','重庆','上海','天津']
			let provinceName=''
			let cityName=''
			// console.log(areaList.length)
			for(let i=1;i<areaList.length;i++){
				if(item.province==areaList[i].value){
					provinceName=areaList[i].label
					if(arr.indexOf(provinceName)>-1){
						provinceName=''
					}
					for(let j=0;j<areaList[i].children.length;j++){
						if(item.city==areaList[i].children[j].value){
							cityName=areaList[i].children[j].label
							// console.log(provinceName,cityName)
							return <span>{`${provinceName}${provinceName && '-'}${cityName}`}</span>
						}
					}
				}
			}
			
		  }},
		{
			title:'项目地址',width:200,dataIndex:'mapAddress',key:'mapAddress',render:(e,item)=>{
				return  item.mapAddress
			}
		}
		 
	];
	function removePrizeImgUrl(index,type) {
		if(type != "awardImgUrl"){
			gamePrizeSetDetail[type].splice(index,1);
		}else{
			gamePrizeSetDetail[type] = ''
		}
		gamePrizeSetDetailList[prizeTabIndex-1] = gamePrizeSetDetail;
        changeState({ gamePrizeSetDetail,gamePrizeSetDetailList })
    }

    function changePrizeImgModal(visible = false, srcs = []) {
        gamePrizeSetImgModal.visible = visible
        gamePrizeSetImgModal.srcs = srcs || modelObj.srcs
        changeState({ gamePrizeSetImgModal })
    }

    //封面图改变时
    function updatePrizeImageModel(value, type) {
		if(type != "awardImgUrl"){
			if(gamePrizeSetDetail[type]){
				gamePrizeSetDetail[type].push(value)
			}else{
				gamePrizeSetDetail[type] = []
				gamePrizeSetDetail[type].push(value)
			}
		}else{
			gamePrizeSetDetail[type] = value
		}
		gamePrizeSetDetailList[prizeTabIndex-1] = gamePrizeSetDetail;
        changeState({ gamePrizeSetDetail,gamePrizeSetDetailList })
    }

	//打开礼品模态框
	function selGift(flag = false, obj = {}){
        giftModalObj.giftVisible = flag
		changeState({giftModalObj})
	}

	//打开优惠券模态框
	function selDiscountCoupon(flag = false, obj = {}){
        giftModalObj.discountCouponVisible = flag
		changeState({giftModalObj})
	}

	//打开兑奖人员模态框
	function selCounselor(flag = false, obj = {}){
		counselorModalObj.counselorVisible = flag
		changeState({counselorModalObj})
	}


	function gamePrizeSetInputChange(value, type, index) {
		if(type == "awardType"){
			if(value == '1'){
				gamePrizeSetDetail.biz.selectedRowKeys = [];
				giftModalObj.discountCoupon = {};
			}else if(value == '2'){
				gamePrizeSetDetail.biz.selectedRowKeys = [];
				giftModalObj.giftInfo = {};
				gamePrizeSetDetail.rewardWay = "1";
			}else if(value == '3') {
				gamePrizeSetDetail.rewardWay = "4";
			}else if(value == '4') {
				gamePrizeSetDetail.rewardWay = "4";
			}else if(value == '0'){
				gamePrizeSetDetail.biz.selectedRowKeys = [];
				giftModalObj.giftInfo = {};
				giftModalObj.discountCoupon = {};
			}
			gamePrizeSetDetail["giftName"] = "";
			changeState({ giftModalObj,gamePrizeSetDetail});
		}else if(type == "rewardWay"){
			if(value != "3"){
				gamePrizeSetDetail.counselors = [];
				gamePrizeSetDetail.redeemUserNames = "";
			}
			// if(value == "2"){
			// 	// gamePrizeSetDetail.estateAddress = [];
			// 	gamePrizeSetDetail.counselors = [];
			// 	gamePrizeSetDetail.redeemUserNames = "";
			// }
		}else if(type == "awardNumber"){
			if(Number(value)<Number(gamePrizeSetDetail.useNumber)){
				message.warn("总库存不能少于已用数量:"+gamePrizeSetDetail.useNumber);
			}
			gamePrizeSetDetail["awardStock"] = Number(value)-Number(gamePrizeSetDetail.useNumber)<0?value+"":(Number(value)-Number(gamePrizeSetDetail.useNumber))+"";
			
		} else if(type == 'consolationAward' && !!value) {
			gamePrizeSetDetailList.map(item => {
				item.consolationAward = '0'
			})
		}
		gamePrizeSetDetail[type] = value;
		gamePrizeSetDetailList[prizeTabIndex-1] = gamePrizeSetDetail;
		form.resetFields();
		changeState({ gamePrizeSetDetail,gamePrizeSetDetailList});
	}

	//日期改变时
	function gamePrizeSetDateChange(m, s, type) {
		if (type == 'redeemTime') {
			gamePrizeSetDetailList[prizeTabIndex-1].startTime = s[0];
			gamePrizeSetDetailList[prizeTabIndex-1].endTime = s[1];
			changeState({
				gamePrizeSetDetail: {
					...gamePrizeSetDetail,
					startTime: s[0],
					endTime: s[1],
				},
				gamePrizeSetDetailList:gamePrizeSetDetailList
			})
        }else if(type=='duration'){
			gamePrizeSetDetailList[prizeTabIndex-1].duration = s;
			changeState({
				gamePrizeSetDetail: {
					...gamePrizeSetDetail,
					duration: s,
				},
				gamePrizeSetDetailList:gamePrizeSetDetailList
			})
		}
	}


	
	// 分页表格属性配置//'admin/gift/list'
	let giftPageProps = {
		// ---------- 界面部分 ----------
		'ui': {
		  // 页面接口地址
		  'api_url': 'admin/gift/list',
		  // "api_url": "admin/housetype/list",
		  // 接口方式
		  'method': 'POST',
		  'app': 'isales-mgmt-application',
		  // 接口参数
		  'params': '',
		  // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
		  // "mockData": mockData,
		  'mockData': null,
		  // 查询栏
		//   'search_bar': {
		// 	'fields': [
		// 	  {
		// 		en_name: 'province',
		// 		zh_name: '省市',
		// 		elem_type: 'Cascader',
		// 		elem_valid_type: 'string',
		// 		cmpt_items: areaList,
		// 		//关联的更改的搜索字段 
		// 		related_key: 'projectId',
		// 		//请求地址
		// 		related_req_url: 'admin/estate/adminList',
		// 		//默认请求
		// 		related_req_param: {
		// 		  pageNo: 1,
		// 		  pageSize: 1000
		// 		},
		// 		split_keys: ['province', 'city'],
		// 	  },
		// 	  {
		// 		en_name: 'projectId',
		// 		zh_name: '项目名称',
		// 		elem_type: 'Select',
		// 		elem_valid_type: 'string',
		// 		cmpt_items: []
		// 	  },
		// 	  {
		// 		en_name: 'title',
		// 		zh_name: '礼品名称',
		// 		elem_type: 'Input',
		// 		elem_valid_type: 'string',
		// 	  },
		// 	],
		// 	searchHandler: (p) => { // 自定义搜索按钮回调函数，点击搜索时触发
		// 	  console.log('search click', p)
		// 	},
		// 	resetHandler: (p) => { // 自定义重置按钮回调函数，点击重置时触发
		// 	  console.log('reset click', p)
		// 	},
		// 	searchCallback: params => { // 自定义搜索完成后的后调函数, 搜索完成后触发, 并将本次搜索的参数传入
		// 	  console.log('search finish', params)
		// 	},
		// 	pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
		// 	  'carName',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
		// 	]
		//   },
		  // 数据表格
		  'table': {
			key: 'giftId',
			rowSelectionInfo: {
				type: 'radio',
			},
			rowSelection:{},
			'status_params': 'status=0',
			'status_text': '全部',
			'scroll': { x: 2000 },
			'action_props': { width: 200 },
			// 表头字段列表"
			'fields': [
			  {
				'en_name': 'title',
				'zh_name': '礼品名称',
				width: 200
			  },
			  {
				'en_name': 'projectName',
				'zh_name': '所属项目',
				width: 200
			  },
			  {
				'en_name': 'city',
				'zh_name': '所属城市',
				width: 200,
				render: (a, item, index, d, e, f) => {
				  // console.log(a, item, index, d, e, f)
				  return <span>{item.provinceName}-{item.cityName}</span>
				}
			  },
			  {
				'en_name': 'totalStock',
				'zh_name': '库存量',
				// width: 274,
			  },
			  {
				'en_name': 'shelfStock',
				'zh_name': '上架库存',
				width: 80,
			  },
			  {
				'en_name': 'applyCount',
				'zh_name': '已申领数量',
				width: 80,
				render: (a, item, index, d, e, f) => {
				  return (
					<span>
					  {item.applyCount ? item.applyCount : '0'}
					</span>
				  )
				}
			  },
			  {
				'en_name': 'shelfStatus',
				'zh_name': '状态',
				width: 80,
				render: (text, record) => {
				  return <div>
					{{ true: '已上架', false: '已下架' }[text] || ''}
				  </div>
				}
			  },
			  {
				'en_name': 'limitCount',
				'zh_name': '限领数量',
				width: 100,
			  },
			  {
				'en_name': 'remark',
				'zh_name': '领取规则',
				width: 100,
			  },
			  {
				'en_name': 'lqqx',
				'zh_name': '领取期限',
				width: 240,
				render: (text, item) => {
				  return <div>{`${item.startOnlineTime.split(' ')[0] || ''}${item.endOnlineTime && ' ~ ' || ''}${item.endOnlineTime.split(' ')[0] || ''}`}</div>
				}
			  },
			  {
				'en_name': 'createTime',
				'zh_name': '创建时间',
				width: 200,
			  },
			  {
				'en_name': 'updateTime',
				'zh_name': '更新时间',
				width: 200,
			  },
			  {
				'en_name': 'updatePerson',
				'zh_name': '更新人',
				width: 80,
			  },
	
			]
		  },
		  // 操作栏
		  action_bar: [
			{
				// label:'',
				// type:'',
				rowSelection: [],
				render: () => {
				  return <Input hidden/>
				},
				onClick: (e, row) => {
				}
			  },
		// 	{
		// 	  'func_name': 'add',
		// 	  'label': '新增礼品',
		// 	  btnId: '20401',
		// 	  'type': 'primary',
		// 	  'onClick': (e) => {
		// 		detailSkip("add")
		// 	  }
		// 	},
		// 	{
		// 	  'func_name': 'add',
		// 	  'label': '礼品核销',
		// 	  btnId: '20402',
		// 	  'type': 'primary',
		// 	  'onClick': (e) => {
		// 		checkGift(e)
		// 	  }
		// 	}
		  ],
		},
	  };

	let discountCouponPageProps = {
		// ---------- 界面部分 ----------
		'ui': {
		  // 页面接口地址
		  'api_url': 'admin/coupons/config/list',
		  // "api_url": "admin/housetype/list",
		  // 接口方式
		  'method': 'POST',
		  'app': 'isales-mgmt-application',
		  // 接口参数
		  'params': 'sceneList=2,3',
		  // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
		  // "mockData": mockData,
		  'mockData': null,
		  // 查询栏
		  'search_bar': {
			'fields': [
			//   {
			// 	en_name: 'name',
			// 	zh_name: '优惠券名称',
			// 	elem_type: 'Input',
			// 	elem_valid_type: 'string',
			//   },
			//   {
			// 	en_name: 'type',
			// 	zh_name: '优惠券类型',
			// 	elem_type: 'Select',
			// 	elem_valid_type: 'string',
			// 	cmpt_items: [
			// 	  {
			// 		value: '1',
			// 		label: '代金券'
			// 	  },
			// 	  {
			// 		value: '2',
			// 		label: '折扣券'
			// 	  }
			// 	],
			//   },
			//   {
			// 	en_name: 'validTime',
			// 	zh_name: '有效期',
			// 	elem_type: 'Date',
			// 	format: 'YYYY-MM-DD',
			// 	// query_format: "YYYY-MM-DD HH:mm:ss",   // 请求参数, 当请求参数和显示时格式不同可通过该参数区分
			// 	// double: true,  // 日期范围组件 使用"YYYY-MM-DD HH:mm:ss"格式时, 显示不全时可使用该参数, 将占据两格位置
			// 	split_keys: ['startTime', 'expireDate'],
			// 	elem_valid_type: 'string'
			//   },
			//   {
			// 	en_name: 'status',
			// 	zh_name: '优惠券状态',
			// 	elem_type: 'Select',
			// 	elem_valid_type: 'string',
			// 	cmpt_items: [
			// 	  {
			// 		value: '1',
			// 		label: '未上架'
			// 	  },
			// 	  {
			// 		value: '2',
			// 		label: '已上架'
			// 	  },
			// 	  {
			// 		value: '3',
			// 		label: '已下架'
			// 	  },
			// 	  {
			// 		value: '4',
			// 		label: '已过期'
			// 	  }
			// 	],
			//   },
			], 
			searchHandler: (p) => { // 自定义搜索按钮回调函数，点击搜索时触发
			 // console.log('search click', p)
			},
			resetHandler: (p) => { // 自定义重置按钮回调函数，点击重置时触发
			 // console.log('reset click', p)
			},
			searchCallback: params => { // 自定义搜索完成后的后调函数, 搜索完成后触发, 并将本次搜索的参数传入
			 // console.log('search finish', params)
			},
			pasteTargetList: [  // 列表组件中将输入框的en_name作为默认id(也可以通过id另外设置)
			  'carName',  // 将需要粘贴事件拦截的输入框id以数组的形式传入, 该参数对应PasteFromClipboard组件的targetList参数
			]
		  },
		  // 数据表格
		  'table': {
			key: 'couponsConfigId',
			rowSelectionInfo: {
				type: 'radio',
			},
			'status_params': 'status=0',
			'status_text': '全部',
			'scroll': {x: 1100},
			'action_props': {width: 200},
			// 表头字段列表"
			'fields': [
			  {
				'en_name': 'name',
				'zh_name': '优惠券名称',
				width: 200
			  },
			  {
				'en_name': 'projectName',
				'zh_name': '项目名称',
				// width: 274,
				render: (text, record) => {
				  return <div className={styles.longEllipsis} title={text}>{text}</div>
				}
			  },
			  {
				'en_name': 'scene',
				'zh_name': '使用场景',
				width: 120,
				render: (text, record) => {
				  return (<span>{text+''=='1'?'普通场景':(text+''=='2'?'拼团场景':text+''=='3'?'活动场景':'')}</span>)
				}
			  },
			  {
				'en_name': 'type',
				'zh_name': '类型',
				width: 80,
				render: (text, record) => {
				  return <span>{{1: '代金券', 2: '折扣券'}[record.type] || ''}</span>
				}
			  },
			  {
				'en_name': 'sqcj',
				'zh_name': '有效使用时间',
				width: 220,
				render: (text, item) => {
				  return <div>{`${item.startTime || ''}${item.expireDate && ' ~ '||''}${item.expireDate || ''}`}</div>
				}
			  },
			  {
				'en_name': 'status',
				'zh_name': '状态',
				width: 80,
				render: (text, record) => {
				  return <div>
					{{1: '未上架', 2: '已上架', 3: '已下架', 4: '已过期'}[text] || ''}
				  </div>
				}
			  },
			],
			// 'actions': [
			//   {
			// 	func_name: 'bussinessDetail',
			// 	label: '业务详情',
			// 	render: (record) => {
				  
			// 	  return (
	
			// 		<div>
			// 		  <FlagBtn node={<Link to='home/couponAdmin/couponDetail' query={{couponsConfigId: record.couponsConfigId}}>查看详细<span className="ant-divider" style={{display:'inline-block'}}/></Link>} btnId={'20302'}> </FlagBtn>
			// 		  {/* <Link to='home/couponAdmin/couponDetail' query={{couponsConfigId: record.couponsConfigId}}>查看详细</Link> */}
			// 		  {/*<span className={cx("ant-divider")} />*/}
			// 		  {/*<Link onClick={() => {
			// 								dispatch({ type: `${namespace}/dowmCoupon`, payload: { params: { couponsConfigId: record.couponsConfigId, status: '3' } } })
			// 							}}>下架</Link>*/}
			// 		 { record.status!=4?
			// 		 <FlagBtn node={<Link to='home/couponAdmin/couponAdd' query={{couponsConfigId: record.couponsConfigId}}>编辑<span className="ant-divider" style={{display:'inline-block'}}/></Link>} btnId={'20303'}> </FlagBtn>:null
			// 		 }
	
			// 		  <FlagBtn node={<Popconfirm Collapse title='确定要删除该优惠券吗？' okText='确定' cancelText='取消'
			// 					  onConfirm={() => {
			// 						dispatch({
			// 						  type: `${namespace}/deleteCoupon`,
			// 						  payload: {params: {id: record.couponsConfigId}}
			// 						})
			// 					  }}>
			// 			<Link>删除<span className="ant-divider" style={{display:'inline-block'}}/></Link>
			// 		  </Popconfirm>} btnId={'20305'}> </FlagBtn>
	
			// 		  <FlagBtn node={<Link to='home/couponAdmin/couponReport' query={{couponsConfigId: record.couponsConfigId}}>查看报表<span className="ant-divider" style={{display:'inline-block'}}/></Link>} btnId={'20304'}> </FlagBtn>
	
			// 		  {/* <a target={'_blank'} href={`${config.baseUrl}admin/coupons/export/${record.couponsConfigId}`}>导出</a> */}
			// 		  <FlagBtn node={<Link onClick={() => {
			// 			dispatch({
			// 			  type: `${namespace}/exportCoupon`,
			// 			  payload: {cb: downFile, params: {couponsConfigId: record.couponsConfigId}}
			// 			})
			// 		  }}>导出</Link>} btnId={'20306'}> </FlagBtn>
					  
			// 		  {/* <span className={cx("ant-divider")} /> */}
			// 		  {/* <Link onClick={() => { }}>导入</Link> */}
			// 		</div>
			// 	  )
			// 	}
			//   }
			// ]
		  },
		  // 操作栏
		  action_bar: [
			{
				// label:'',
				// type:'',
				rowSelection: [],
				render: () => {
				  return <Input hidden/>
				},
				onClick: (e, row) => {
				}
			}
		  ],
		},
	  };

	  let counselorPageProps = {
		// ---------- 界面部分 ----------
        "ui": {
            // 页面接口地址
            "api_url": "admin/propertyConsultant/queryList",
            // 接口方式
            "method": "POST",
            "app": "",
            // 接口参数
            "params": `productId=${gameBaseDetail.productId}`,
            // 模拟数据 - 用于开发需要，若填充了上面的api_url之后，请将此项设置为null
            // "mockData": mockData,
            "mockData": null,
            action_bar: [
                {
					// label:'',
					// type:'',
					rowSelection: [],
					render: () => {
					  return <Input hidden/>
					},
					onClick: (e, row) => {
					}
				}
            ],
            // 数据表格
            "table":
                {
					rowSelectionInfo: {
						type: 'checkbox',
					},
                    "status_params": "status=0",
                    "status_text": "全部",
                    // 表头字段列表
                    "scroll": { x: 1500 },
                    "fields": [
                        {
                            "en_name": "outerAccount",
                            "zh_name": "用户账号",
                        },
                        {
                            "en_name": "counselorId",
                            "zh_name": "置业顾问编号",
                        },
                        {
                            "en_name": "productName",
                            "zh_name": "所属项目",
                        },
                        {
                            "en_name": "cityName",
                            "zh_name": "所属城市",
                            width:150,
                            render: (text, item, index) => {
                                return `${item.provinceName||''}${item.provinceName&&item.cityName&&' - '||''}${item.cityName||''}`
                            }
                        },
                        {
                            "en_name": "name",
                            "zh_name": "置业顾问姓名",
                            width:80,
                        },
                        {
                            "en_name": "sex",
                            "zh_name": "性别",
                            width:60,
                            render: (a, item, index, d, e, f) => {
                                if(!(item.sex == undefined || item.sex == null)){
                                    return item.sex === 1 ? '男' : '女'
                                }
                            }
                        },
                        {
                            "en_name": "mobile",
                            "zh_name": "手机号码",
                            width:130,
                        },
                        {
                            "en_name": "creator",
                            "zh_name": "创建人",
                        },
                        {
                            "en_name": "createTime",
                            "zh_name": "创建时间",
                            width:180,
                        },
                       
                    ]
                },
        },
    };

	  
	(['0']).map((item, index) => {
		let _biz = gamePrizeSetDetail.biz
		if (!!_biz) {
			if(gamePrizeSetDetail.awardType == "1"){
				//礼品
				giftPageProps.biz = _biz
				giftPageProps.biz.syncBackCbf = (newbiz) => {
					// if(gamePrizeSetDetail.currentItem.length > 0){
					// 	newbiz.selectedRowKeys=gamePrizeSetDetail.currentItem;
					// }
					// newbiz.selectedRowKeys=gamePrizeSetDetail.currentItem?gamePrizeSetDetailList[prizeTabIndex-1].currentItem:[];
					gamePrizeSetDetail.biz= newbiz;
					gamePrizeSetDetailList[prizeTabIndex-1] = gamePrizeSetDetail;
					dispatch({
						type: `${namespace}/updateStore`,
						payload: {gamePrizeSetDetail,gamePrizeSetDetailList}
					})
				}
			}else if(gamePrizeSetDetail.awardType == "2"){
				//优惠券
				discountCouponPageProps.biz = _biz
				discountCouponPageProps.biz.syncBackCbf = (newbiz) => {
					// if(gamePrizeSetDetail.currentItem.length > 0){
					// 	newbiz.selectedRowKeys=gamePrizeSetDetail.currentItem;
					// }
					// newbiz.selectedRowKeys=gamePrizeSetDetailList[prizeTabIndex-1].currentItem?gamePrizeSetDetailList[prizeTabIndex-1].currentItem:[];
					gamePrizeSetDetail.biz=newbiz;
					gamePrizeSetDetailList[prizeTabIndex-1] = gamePrizeSetDetail;
					dispatch({
						type: `${namespace}/updateStore`,
						payload: {gamePrizeSetDetail,gamePrizeSetDetailList}
					})
				}
			}
		} 
		if(!!gamePrizeSetDetail.counselorBiz){
			if(gamePrizeSetDetail.rewardWay == "3"){
				counselorPageProps.biz = gamePrizeSetDetail.counselorBiz
				counselorPageProps.biz.syncBackCbf = (newbiz) => {
					// if(gamePrizeSetDetail.counselorCurrentItem.length > 0){
					// 	newbiz.selectedRowKeys=gamePrizeSetDetail.counselorCurrentItem
					// }
					gamePrizeSetDetail.counselorBiz=newbiz
					gamePrizeSetDetailList[prizeTabIndex-1] = gamePrizeSetDetail;
					dispatch({
						type: `${namespace}/updateStore`,
						payload: {gamePrizeSetDetail,gamePrizeSetDetailList}
					})
				}
			}
		}
	})


	const confirmGiftData = () => {
		let giftInfo = {}
		let {giftVisible = false} = giftModalObj
		giftModalObj.giftVisible = !giftVisible
		let selectedRows = (gamePrizeSetDetail.biz || {})['selectedRows'] || {}
		let selectedRowKeys = (gamePrizeSetDetail.biz || {})['selectedRowKeys'] || {}
		if (isEmpty(selectedRowKeys)) {
			message.warn('请选择')
			return false
		}
		if(selectedRows[0]){  
			giftInfo = selectedRows[0];
			gamePrizeSetDetail.giftName = giftInfo.title;
			gamePrizeSetDetail.outerId = giftInfo.giftId
			gamePrizeSetDetail.awardName = giftInfo.title;
		}
		gamePrizeSetDetail.currentItem = selectedRowKeys;
		giftModalObj = {...giftModalObj,giftInfo}
		form.resetFields();
		gamePrizeSetDetailList[prizeTabIndex-1] = gamePrizeSetDetail;
		changeState({giftModalObj,gamePrizeSetDetail,gamePrizeSetDetailList})
	}

	function confirmDiscountCouponData(){
		let discountCouponInfo = {}
		let {discountCouponVisible = false} = giftModalObj
		giftModalObj.discountCouponVisible = !discountCouponVisible
		let selectedRows = (gamePrizeSetDetail.biz || {})['selectedRows'] || {}
		let selectedRowKeys = (gamePrizeSetDetail.biz || {})['selectedRowKeys'] || {}
		if (isEmpty(selectedRowKeys)) {
			message.warn('请选择')
			return false
		}
		
		if(selectedRows[0]){  
			discountCouponInfo = selectedRows[0];
			gamePrizeSetDetail.giftName = discountCouponInfo.name;
			gamePrizeSetDetail.outerId = discountCouponInfo.couponsConfigId
			gamePrizeSetDetail.awardName = discountCouponInfo.name;
		}
		gamePrizeSetDetail.currentItem = selectedRowKeys;
		giftModalObj = {...giftModalObj,discountCouponInfo}
		form.resetFields();
		gamePrizeSetDetailList[prizeTabIndex-1] = gamePrizeSetDetail;
		changeState({giftModalObj,gamePrizeSetDetail,gamePrizeSetDetailList})
	}


	function confirmCounselorData(){
		let counselorInfos = [];
		let {counselorVisible = false} = counselorModalObj
		counselorModalObj.counselorVisible = !counselorVisible
		let selectedRows = (gamePrizeSetDetail.counselorBiz || {})['selectedRows'] || {}
		let selectedRowKeys = (gamePrizeSetDetail.counselorBiz || {})['selectedRowKeys'] || {}
		if (isEmpty(selectedRowKeys)) {
			message.warn('请选择')
			return false
		}
		if(selectedRows.length > 0){
			let name = "";
			gamePrizeSetDetail.counselors = [];
			gamePrizeSetDetail.redeemUserNames = "";
			for(let i=0;i<selectedRows.length;i++){
				counselorInfos.push(selectedRows[i]);
				if(i > 0){
					gamePrizeSetDetail.redeemUserNames += ",";
				}
				let m = {
					counselorId:selectedRows[i].counselorId,
					counselorName:selectedRows[i].name
				};
				gamePrizeSetDetail.counselors.push(m);
				gamePrizeSetDetail.redeemUserNames += selectedRows[i].name;
			}
			
		}
		gamePrizeSetDetail.counselorCurrentItem = selectedRowKeys
		counselorModalObj = {...counselorModalObj,counselorInfos}
		form.resetFields('redeemUserNames');
		gamePrizeSetDetailList[prizeTabIndex-1] = gamePrizeSetDetail;
		changeState({counselorModalObj,gamePrizeSetDetail,gamePrizeSetDetailList})
	}
	/*
	
	==============================奖项设置代码结束=======================================
	*/

    /*
    =============================高级设置代码开始=========================================
    */

    function gameHighSetInputChange(value, type, index) {
		gameHighSetDetail[type] = value;
		//console.log(type);
		//console.log(value);
		if(type=='allowSharing'&&value=='0'){
			gameHighSetDetail['assistedOpening'] = '0';
		}
		form.resetFields();
        changeState({ gameHighSetDetail })
    }

    function removeImgUrl(type) {
        gameHighSetDetail[type] = ''
        changeState({ gameHighSetDetail })
    }

    function changeImgModal(visible = false, srcs = []) {
        gameHighSetImgModal.visible = visible
        gameHighSetImgModal.srcs = srcs || modelObj.srcs
        changeState({ gameHighSetImgModal })
    }

    //封面图改变时
    function updateImageModel(value, type) {
        gameHighSetDetail[type] = value
        changeState({ gameHighSetDetail })
	}
	
	const dailyLoginRewardRange = rewardRange.filter(o => !dailyLogins.includes(o));

	const handleChangeDailyLogin = dailyLogins => {
		dispatch({
			type:`${namespace}/updateStore`,
			payload: {
				dailyLogins
			}
		})
	}

	const dailyLoginCheck = e => {
		dispatch({
			type:`${namespace}/updateStore`,
			payload: {
				dailyLoginChecked: e.target.checked
			}
		})
	}

	const developAgentsRewardRange = rewardRange.filter(o => !developAgents.includes(o));

	const handleChangeDevelopAgent = developAgents => {
		dispatch({
			type:`${namespace}/updateStore`,
			payload: {
				developAgents
			}
		})
	}

	const developAgentCheck = e => {
		dispatch({
			type:`${namespace}/updateStore`,
			payload: {
				developAgentChecked: e.target.checked
			}
		})
	}

	const onlineBuyRewardRange = rewardRange.filter(o => !onlineBuy.includes(o));

	const handleChangeOnlineBuy = onlineBuy => {
		dispatch({
			type:`${namespace}/updateStore`,
			payload: {
				onlineBuy
			}
		})
	}

	const onlineBuyCheck = e => {
		dispatch({
			type:`${namespace}/updateStore`,
			payload: {
				onlineBuyChecked: e.target.checked
			}
		})
	}

    /*
    =============================高级设置代码结束=====================================
    */
//    const operations = <div className={"functionButton"}>
// 						<Button type='primary' onClick={e => submit(1)} loading={btnLoading}>保存</Button>
// 					</div>;
    return(
	<div className={cx('pageLayout')}>
      <div className='public_listMain'>
        <div className={"functionButton"}>
			<Affix offsetTop={80}>
				<Button type='primary' onClick={e => submit(1)} loading={btnLoading}>保存</Button>
			</Affix>
        </div>
        <Tabs onChange={tabCallback} type="card" activeKey={tabKey}>
            <TabPane tab="基础设置" key="1">
            <div className={cx('pageLayout')}>
			<div className='public_listMain'>
				<Form>
					<div className="boxShadow">
						<CollapsiblePanels title={'基本选项'} hideUpDownBtn={true}>
                            <Row>
                                <Col span={12}>
									<FormItem {...formItemLayout} label="投放程序">
										{getFieldDecorator('launchApp', {
											initialValue: gameBaseDetail.launchApp,
											rules: [
												{ required: tabKey=='1', whitespace: true, message: '请选择投放程序'},
											 ],
										})(
											<Radio.Group onChange={(e) => gameBaseInputChange(e.target.value, 'launchApp')} disabled={gameType!=0}>
												<Radio value='1'>美的置业云</Radio>
												<Radio value='2'>智美秀</Radio>
											</Radio.Group>
										)}
									</FormItem>
								</Col>
                            </Row>
							<Row>
								<Col span={12}>
									<FormItem {...formItemLayout} label="推广模式">
										{getFieldDecorator('promoteStatus', {
											initialValue: gameBaseDetail.promoteStatus,
											rules: [
												{ required: tabKey=='1', whitespace: true, message: '请选择推广模式', type: 'boolean' },
											],
										})(
											// disabled={gameBaseDetail.launchApp == "2"}
											<Radio.Group  onChange={(e) => gameBaseInputChange(e.target.value, 'promoteStatus')}>
												<Radio value={isPromotePro}>项目推广</Radio>
												<Radio value={!isPromotePro}>非项目推广</Radio>
											</Radio.Group>
										)}
									</FormItem>
								</Col>
								{
									gameBaseDetail.promoteStatus &&
									<Col className="col" span={12}>
										<FormItem {...formItemLayout} label="推广项目">
											{getFieldDecorator('projectId', {
												initialValue: gameBaseDetail.projectId,
												rules: [
													{
														required:gameBaseDetail.promoteStatus && tabKey=='1',
														whitespace: true, message: '请选择推广项目',
														validator: (rule, value, callback) => {
														//	console.log(rule, value);
														}
													},
												],
											})(
												<InputGroup compact>
													<Cascader style={{ width: '50%' }}
														options={areaList}
														value={[`${gameBaseDetail.province}`, `${gameBaseDetail.city}`]}
														onChange={(value, selectedOptions) => gameBaseInputChange(value, "areaId")} placeholder="请选择所属城市" />
													<Select style={{ width: '50%' }} notFoundContent={'该省市中无楼盘'}
														 value={gameBaseDetail.productId}
														onChange={(value) => gameBaseInputChange(value, 'productId')} placeholder="请选择项目">
														{
															estateList && estateList.map((item, index) => (
																<Select.Option key={`house_${index}`} value={item.productId}>{item.name}</Select.Option>
															))
														}
													</Select>
												</InputGroup>
											)}
										</FormItem>
									</Col>
								}
								{
									!gameBaseDetail.promoteStatus &&<Col className="col" span={12}>
									<FormItem {...formItemLayout} label="所属区域">
									  {getFieldDecorator('regionId', {
										initialValue: gameBaseDetail.regionId,
										rules: [
										  {
											required: true, message: '请选择所属区域'
										  },
										],
									  })(
										// notFoundContent={'该省市中无楼盘'}
										<Select placeholder='请选择区域' onChange={(e, opt) => {
											gameBaseInputChange(e, 'regionId',opt)
										}}>
										  {
											roleType == 1 ? <Select.Option key='0' value='A3003353'>集团总部</Select.Option> : null
										  }
		  
										  {area1.length > 0 && area1.map((item) => {
											return <Select.Option key={item.value} value={item.value}>{item.label}</Select.Option>
										  })}
										</Select>)}
									</FormItem>
								  </Col>
								}
                            </Row>
							{gameBaseDetail.launchApp != "2" &&
							
							
							<Row>
								{ gameType != '1' && <Col span={12}>
									<FormItem
										{...formItemLayout4}
										extra="图片尺寸:1500px*920px,文件大小：500kb,备注：需要传png格式图片，否则影响展示效果"
										label="主页banner"
									>
										<div className={cx('uploaderBox')}>
											<div className={cx('uploaderDiv')}>
												<Uploader 
													className={cx('uploadDiv')}
													uploadedUrls={gameBaseDetail.bannerUrl}
													removeFileCbf={() => { removeBaseImgUrl('bannerUrl') }}
													uploadSuccessCbf={(imgUrl) => {
														updateBaseImageModel(imgUrl, 'bannerUrl')
													}}
													// showType={actionType == 'detail'?'4':"3"}
													showType='2' 
													minCropBoxWidth={1500}
													minCropBoxHeight={920}
													// unsetWidth={true}
													fileType='image'
													fileMaxSize='0.5'
													maxFiles='1'
												/>
											</div>
										</div>
									</FormItem>
								</Col>}
									
								<Col span={12}>
									<FormItem
										{...formItemLayout4}
										extra="图片尺寸:750px*250px,文件大小：500kb,备注：需要传png格式图片，否则影响展示效果"
										label="小游戏顶部图片"
									>
										<div className={cx('uploaderBox')}>
											<div className={cx('uploaderDiv')}>
												<Uploader 
													className={cx('uploadDiv')}
													uploadedUrls={gameBaseDetail.titleImgUrl}
													removeFileCbf={() => { removeBaseImgUrl('titleImgUrl') }}
													uploadSuccessCbf={(imgUrl) => {
														updateBaseImageModel(imgUrl, 'titleImgUrl')
													}}
													// showType={actionType == 'detail'?'4':"3"}
													showType='2'
													minCropBoxWidth={750}
													minCropBoxHeight={250}
													// unsetWidth={true}
													fileType='image'
													fileMaxSize='0.5'
													maxFiles='1'
												/>
											</div>
										</div>
									</FormItem>
								</Col>
							</Row>
							}

							<Row>
								<Col span={12}>
									<FormItem label='活动标题'  {...formItemLayout}>
										{getFieldDecorator('title', {
											rules: [{
												required: true, message: '方案最多14个字', max: 14
											  }],
											initialValue: gameBaseDetail.title ? gameBaseDetail.title + '' : undefined
										})(
											<Input
												// disabled={actionType == 'detail'}
												placeholder='方案最多14个字' onChange={(e) => { gameBaseInputChange(e.target.value, 'title') }} />
										)}
									</FormItem>
								</Col>
								<Col span={10}>
									<FormItem
										{...formItemLayoutTime}
										label="活动时间"
									// extra="注：同一时间，如果美的置业云首页有集团设置的弹窗广告，将只会显示集团设置的弹窗广告,生效时间最长设置时间为15天"
									>
										{getFieldDecorator('startTime', {
											rules: [{ required: tabKey=='1', message: '请选择活动限期' },
											],
											initialValue: gameBaseDetail.startTime ? [moment(gameBaseDetail.startTime, 'YYYY-MM-DD HH:mm:ss'), moment(gameBaseDetail.endTime, 'YYYY-MM-DD HH:mm:ss')] : [],
										})(

											<RangePicker
												style={{ width: "100%" }}
												showTime={{
													hideDisabledOptions: true,
													defaultValue: [moment(null, 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],

												}}
												format="YYYY-MM-DD HH:mm:ss" onChange={(date, dateString) => { gameBaseDateChange(date, dateString, 'activeTime') }}
											/>

										)}
									</FormItem>
								</Col>
							</Row>
							{gameBaseDetail.launchApp != "2" && 
								<Row>
									<Col span={12}>
										<FormItem label='虚拟参与人数'  {...formItemLayout}>
											{getFieldDecorator('virtualNumber', {
												rules: [
													{ required: false, whitespace: true, message: '请输入虚拟参与人数'},
													{ pattern: /^[1-9]\d*$/, message: '请输入整数' }, 
												],
												initialValue: gameBaseDetail.virtualNumber ? gameBaseDetail.virtualNumber+"" : ""
											})(
												<Input placeholder='请输入虚拟参与人数' onChange={(e) => { gameBaseInputChange(e.target.value, 'virtualNumber') }} />
											)}
										</FormItem>
									</Col>
									<Col span={2}><Tooltip title="说明：虚拟参与人数会在游戏界面中显示。"><Icon type="question-circle" className={cx('iconTip')} /></Tooltip></Col>
									
								</Row>
							}
                            
							
							{/* {!gameBaseDetail.promoteStatus && */}
								<div>
									{/* <FormItem>
										<Row>
											<div style={{ "fontWeight": "600" }}>活动发布范围 </div>
											<div style={{fontSize:'12px',lineHeight:'12px'}}>{warn}</div>
										</Row>
										
									</FormItem> */}
									{formItems}
									{actionType == 'detail' ? null :
										<FormItem required='false'>
											{getFieldDecorator('useRange', {
												rules:[{
												validator: function(rule, str, callback){
													// if(!gameBaseDetail.promoteStatus){
														if(query.wholeCountry||query.provinceCodes.length>0){
															callback();
														}else{
															callback('请选择城市范围');
														}
													// }else{
													// 	callback();
													// }
													}//todo
												} 
												],
											})(
											<Button style={{marginLeft:'9%'}} type='primary' onClick={(e) => { add() }}>新增中奖范围</Button>)
											}
										</FormItem>
									}
								</div>
							{/* } */}
						</CollapsiblePanels>
						<CollapsiblePanels title={'活动规则'} hideUpDownBtn={true}>
							<Row>
								<Col className="col" span={24} >
									<FormItem>
										<Ueditor id="addBaseDesc"
											style={{ width: '100%', height: 900 }}
											editable={true}
											html={gameBaseDetail.ruleDesc || ''}
											title={gameBaseDetail.title || ''}
											startDate={gameBaseDetail.startTime || ''}
											endDate={gameBaseDetail.endTime || ''}
											height={500}
											isSubmit={isSubmit}
											inputChange={e => {
												dispatch({ type: `${namespace}/gameBaseDealEditor`, payload: { ruleDesc: e } })
											}}
											isSubmit={
												e => { dispatch({ type: `${namespace}/updateStore`, payload: { isSubmit: e.isSubmit } }) }
											}
										/>
									</FormItem>

								</Col>

							</Row>

						</CollapsiblePanels>
					</div>
				</Form>

 
			</div>
		</div>
            </TabPane>
            <TabPane tab="派奖方式" key="2" >
            <div className={cx('pageLayout')}>
			<div className='public_listMain'>
				<Form>
					<div className="boxShadow">
						<CollapsiblePanels title={'参与人设置'} hideUpDownBtn={true}>
                            
							<Row>
                                <Col span={24}>
									<FormItem {...formItemLayoutForTime} label="参与人群">
										{getFieldDecorator('participators', {
											initialValue: gamePrizeWayDetail.participators,
											rules: [
												{ required: tabKey=='2', whitespace: true, message: '请选择参与人群', type: 'string' },
											],
										})(
											<Radio.Group disabled={gameBaseDetail.launchApp == "2"} onChange={(e) => gamePrizeTabInputChange(e.target.value, 'participators')}>
												<Radio value="0">全部</Radio>
												<Radio value="1">业主</Radio>
												{/* <Radio value="2">经纪人</Radio> */}
												<Radio value="3">成功推介客户认购的经纪人</Radio>
												<Radio value="4">最近推介的经纪人</Radio>
												<Radio value="5">美的置业云公众号用户</Radio>
											</Radio.Group>
										)}
									</FormItem>
								</Col>
                            </Row>

							<Row>
								<Col span={10}>
									<FormItem
										{...formItemLayoutTime}
										label="客户认购时间"
									// extra="注：同一时间，如果美的置业云首页有集团设置的弹窗广告，将只会显示集团设置的弹窗广告,生效时间最长设置时间为15天"
									>
										{getFieldDecorator('startSubscriptionTime', {
											rules: [{ required: (gamePrizeWayDetail.participators=='3' || gamePrizeWayDetail.participators == '1') && tabKey=='2', message: '请选择客户认购限期' },
											],
											initialValue: gamePrizeWayDetail.startSubscriptionTime && gamePrizeWayDetail.startSubscriptionTime != '' ? [moment(gamePrizeWayDetail.startSubscriptionTime, 'YYYY-MM-DD HH:mm:ss'), moment(gamePrizeWayDetail.endSubscriptionTime, 'YYYY-MM-DD HH:mm:ss')] : [],
										})(

											<RangePicker
												disabled={gamePrizeWayDetail.participators!='3' && gamePrizeWayDetail.participators != '1'}
												style={{ width: "100%" }}
												showTime={{
													hideDisabledOptions: true,
													defaultValue: [moment(null, 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],

												}}
												format="YYYY-MM-DD HH:mm:ss" onChange={(date, dateString) => { gamePrizeWayDateChange(date, dateString, 'subscriptionTime') }}
											/>

										)}
									</FormItem>
								</Col>
								<Col span={10}>
									<FormItem
										{...formItemLayoutTime}
										label="推介时间"
									// extra="注：同一时间，如果美的置业云首页有集团设置的弹窗广告，将只会显示集团设置的弹窗广告,生效时间最长设置时间为15天"
									>
										{getFieldDecorator('startMarketingTime', {
											rules: [{ required: gamePrizeWayDetail.participators=='4' && tabKey=='2', message: '请选择推介限期' },
											],
											initialValue: gamePrizeWayDetail.startMarketingTime && gamePrizeWayDetail.startMarketingTime != '' ? [moment(gamePrizeWayDetail.startMarketingTime, 'YYYY-MM-DD HH:mm:ss'), moment(gamePrizeWayDetail.endMarketingTime, 'YYYY-MM-DD HH:mm:ss')] : [],
										})(

											<RangePicker 
												disabled={gamePrizeWayDetail.participators!='4'}
												style={{ width: "100%" }}
												showTime={{
													hideDisabledOptions: true,
													defaultValue: [moment(null, 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],
												}}
												format="YYYY-MM-DD HH:mm:ss" onChange={(date, dateString) => { gamePrizeWayDateChange(date, dateString, 'marketingTime') }}
											/>

										)}
									</FormItem>
								</Col>
							</Row>
							

						</CollapsiblePanels>
						<CollapsiblePanels title={'中奖率'} hideUpDownBtn={true}>
							<Row>
								<Col span={12}>
									<FormItem label='每人中奖次数'  {...formItemLayout6}>
										<span style={{fontSize:'12px'}}>每人最多可中奖</span>
										{getFieldDecorator('winningTimesPerPerson', {
											rules: [
												{ required: tabKey=='2', whitespace: true, message: '请输入每人最多可中奖次数'},
												{ pattern: /^[1-9]\d*$/, message: '请输入整数' },
											],
											initialValue: gamePrizeWayDetail.winningTimesPerPerson ? gamePrizeWayDetail.winningTimesPerPerson+"" : ""
										})(
											<Input placeholder='请输入每人最多可中奖次数' style={{margin:'0 10px',width:'47%'}} onChange={(e) => { gamePrizeTabInputChange(e.target.value, 'winningTimesPerPerson') }} />
										)}
										<span style={{fontSize:'12px'}}>次</span>
									</FormItem>
								</Col>
							</Row>
							<Row>
								<Col span={12}>
									<FormItem label='每人总抽奖次数'  {...formItemLayout6}>
										<span style={{fontSize:'12px'}}>每人最多可抽奖</span>
										{getFieldDecorator('luckDrawTimesMax', {
											rules: [
												{ required: tabKey=='2', whitespace: true, message: '请输入每人最多可抽奖次数'},
												{ pattern: /^[1-9]\d*$/, message: '请输入整数' },
											],
											initialValue: gamePrizeWayDetail.luckDrawTimesMax ? gamePrizeWayDetail.luckDrawTimesMax+"" : ""
										})(
											<Input placeholder='请输入每人最多可抽奖次数' style={{margin:'0 10px',width:'47%'}} onChange={(e) => { gamePrizeTabInputChange(e.target.value, 'luckDrawTimesMax') }} />
										)}
										<span style={{fontSize:'12px'}}>次</span>
									</FormItem>
								</Col>
							</Row>
							{/* <Row>
								<Col span={12}>
									<FormItem label='预计参与人数'  {...formItemLayout}>
										{getFieldDecorator('expectedNumber', {
											rules: [
												{ required: tabKey=='2', whitespace: true, message: '请输入预计参与人数'},
												{ pattern: /^[1-9]\d*$/, message: '请输入整数' },
											],
											initialValue: gamePrizeWayDetail.expectedNumber ? gamePrizeWayDetail.expectedNumber+"" : ""
										})(
											<Input placeholder='请输入预计参与人数' style={{margin:'0 10px',width:'120px'}} onChange={(e) => { gamePrizeTabInputChange(e.target.value, 'expectedNumber') }} />
										)}
									</FormItem>
								</Col>
								
							</Row> */}
							<Row>
								<Col span={12}>
									<FormItem label='总中奖概率'  {...formItemLayout}>
										{getFieldDecorator('winningRate', {
											rules: [//pattern: /^(?:0|[1-9][0-9]?|100)$/, 
												{ required: tabKey=='2', whitespace: true,message: '请输入总中奖概率'},
												{ pattern:/^(\d|[0-9]\d|100)(\.\d{1,2})?$/,message: '请输入0-100的数字(支持2位小数)' },
											],
											initialValue: gamePrizeWayDetail.winningRate ? gamePrizeWayDetail.winningRate+"" : ""
										})(
											<Input placeholder='请输入总中奖概率' style={{margin:'0 10px',width:'120px'}} onChange={(e) => { gamePrizeTabInputChange(e.target.value, 'winningRate') }} />
										)}
										<span>%</span>
										<Tooltip title="说明：若设置中奖概率为100%，这意味着所有人都可以参与领奖；若设置中奖概率为0.01%-99.99%，假如中奖概率为0.01%，这意味着每10000次抽奖1次获奖。"><Icon type="question-circle" className={cx('iconTip')} /></Tooltip>
									</FormItem>
								</Col>
							</Row>

							<Row>
								<Col span={12}>
									<FormItem label='每人初始抽奖次数'  {...formItemLayout6}>
										<span style={{fontSize:'12px'}}>每人初始拥有</span>
										{getFieldDecorator('luckDrawTimesInit', {
											initialValue: gamePrizeWayDetail.luckDrawTimesInit ? gamePrizeWayDetail.luckDrawTimesInit+"" : ""
										})(
											<Input disabled={gameActivityId} placeholder='请输入请输入每人初始抽奖次数' style={{margin:'0 10px',width:'120px'}} onChange={(e) => { gamePrizeTabInputChange(e.target.value, 'luckDrawTimesInit') }} />
										)}
										<span style={{fontSize:'12px'}}>次抽奖机会</span>
									</FormItem>
								</Col>
							</Row>
							<Row>
								<Col span={24}>
									<Row>
										<Col span={3}><span style={{fontSize:'12px', marginLeft:'10px'}}>增加抽奖次数:</span></Col>
										<Col span={6}>
											<FormItem>
											<Checkbox onChange={dailyLoginCheck}  checked={dailyLoginChecked}> 每日首次登录 </Checkbox>
											<Tooltip title="每天登陆美的置业云小程序增加一次抽奖机会"><Icon type="question-circle" className={cx('iconTip')} /></Tooltip>
											</FormItem>
										</Col>
										<Col span={12}>
											<FormItem label='该方式奖项范围' {...formItemLayout3}>
											<Select
											defaultValue={dailyLogins}
											disabled={!dailyLoginChecked}
											mode="multiple"
											placeholder="请选择奖项范围"
											onChange={handleChangeDailyLogin}
											style={{ width: '100%' }}
										>
											{dailyLoginRewardRange.map(item => (
											<Select.Option key={item} value={item}>
												{item}
											</Select.Option>
											))}
										</Select>
										
										</FormItem>
										</Col>
									</Row>
									<Row>
										<Col span={3}></Col>
										<Col span={6}>
											<FormItem label='' {...formItemLayout3}>
												<Checkbox onChange={developAgentCheck} checked={developAgentChecked}> 活动期间发展经纪人 </Checkbox>
												<Tooltip title="活动期间每发展一个二级经纪人，增加一次抽奖机会。"><Icon type="question-circle" className={cx('iconTip')} /></Tooltip>
											</FormItem>
										</Col>
										<Col span={12}>
										<FormItem label='该方式奖项范围' {...formItemLayout3}>
										
										<Select
											defaultValue={developAgents}
											disabled={!developAgentChecked}
											mode="multiple"
											placeholder="请选择奖项范围"
											onChange={handleChangeDevelopAgent}
											style={{ width: '100%' }}
										>
											{developAgentsRewardRange.map(item => (
											<Select.Option key={item} value={item}>
												{item}
											</Select.Option>
											))}
										</Select>
										</FormItem>
										</Col>
									</Row>
									<Row>
										<Col span={3}></Col>
										<Col span={6}>
										<FormItem label='' {...formItemLayout3}>
											<Checkbox onChange={onlineBuyCheck} checked={onlineBuyChecked}> 活动期间在线认购 </Checkbox>
											<Tooltip title="活动期间每线上认购一套房源（任意房源类型，包括住宅、商铺、公寓、储藏室等，但一定要线上认购。认筹、小订、线下认购不算），增加一次抽奖机会。"><Icon type="question-circle" className={cx('iconTip')} /></Tooltip>
											</FormItem>
										</Col>
										<Col span={12}>
										<FormItem label='该方式奖项范围' {...formItemLayout3}>
										<Select
											defaultValue={onlineBuy}
											disabled={!onlineBuyChecked}
											mode="multiple"
											placeholder="请选择奖项范围"
											onChange={handleChangeOnlineBuy}
											style={{ width: '100%' }}
										>
											{onlineBuyRewardRange.map(item => (
											<Select.Option key={item} value={item}>
												{item}
											</Select.Option>
											))}
										</Select>

										</FormItem>
										</Col>
									</Row>
								</Col>
							</Row>
						</CollapsiblePanels>
					</div>
				</Form>


			</div>
		</div>
            </TabPane>
			<TabPane tab="奖项设置" key="3">
			<div className={cx('pageLayout')}>
			<div className='public_listMain'>
				<div className={cx('addPrizeBtn')}>
					<Button type='primary' onClick={prizeLeft}>&lt;</Button>
					<Button type='primary' onClick={prizeRight}>&gt;</Button>
					<Button type='primary' onClick={prizeAdd}>添加奖项</Button>
				</div>
				<Tabs hideAdd  tabBarStyle={blockTab} onChange={prizeTabCallback} type="editable-card" activeKey={prizeTabIndex} onEdit={prizeEdit}>
					{panes.map((pane,index) => (
					<TabPane tabBarGutter={0} tab={pane.title} key={pane.key} closable={pane.closable}>
						<Form>
							<div className="boxShadow">
								<CollapsiblePanels title={'奖项设置'} hideUpDownBtn={true}>
									{ gameType == '0' && 
										<Row>
										<FormItem {...formItemLayout4}
											required={tabKey=='3'}
											label="中奖标志的小图标">
											<Uploader uploadedUrls ={gamePrizeSetDetail.prizeImgUrls}
												removeFileCbf={(index)=>{removePrizeImgUrl(index,"prizeImgUrls")}}
												uploadSuccessCbf={ (imgUrl) => {updatePrizeImageModel(imgUrl,"prizeImgUrls")} }
												showType={'6'}
												fileType='image'
												fileMaxSize='0.1'
												minCropBoxWidth={240}
												minCropBoxHeight={240}
												maxFiles='1000' />
										</FormItem>
										<Col span={12}>
											<span style={{ color: "#999", marginLeft: "4%" }}>
											{actionType == 'check'?"":'图片尺寸：240px*240 px，文件大小:100kb，备注：需要传png格式图片，否则影响展示效果'}
											</span>
										</Col>
										</Row>
									}
									{ gameType == '0' && <Divider />}
									{ gameType == '0' &&
										<Row>
										<FormItem {...formItemLayout4}
											required={tabKey=='3'}
											label="未中奖标志的小图标">
											<Uploader uploadedUrls ={gamePrizeSetDetail.noPrizeImgUrls}
												removeFileCbf={(index)=>{removePrizeImgUrl(index,"noPrizeImgUrls")}}
												uploadSuccessCbf={ (imgUrl) => {updatePrizeImageModel(imgUrl,"noPrizeImgUrls")} }
												showType={'6'}
												fileType='image'
												fileMaxSize='0.1'
												minCropBoxWidth={240}
												minCropBoxHeight={240}
												maxFiles='1000' />
										</FormItem>
										<Col span={12}>
											<span style={{ color: "#999", marginLeft: "4%" }}>
											{actionType == 'check'?"":'图片尺寸：240px*240 px，文件大小:100kb，备注：需要传png格式图片，否则影响展示效果。'}
											</span>
										</Col>
											
										</Row>
									}
									{ gameType == '0' && <Divider />}
									
									<Row>
										<Col span={12}>
											<FormItem {...formItemLayout} label="奖项类型" >
												{getFieldDecorator(`content[${index}].awardType`, {
													initialValue: gamePrizeSetDetail.awardType,
													rules: [
														{ required: tabKey=='3', whitespace: true, message: '请选择奖项类型', type: 'string' },
													],
												})(
													<Radio.Group disabled={gameStatus&&gameStatus=='edit'&&!pane.editable} onChange={(e) => gamePrizeSetInputChange(e.target.value, 'awardType')}>
														{/* <Radio.Group disabled={gamePrizeSetDetail.awardStock!=gamePrizeSetDetail.awardNumber} onChange={(e) => gamePrizeSetInputChange(e.target.value, 'awardType')}></Radio.Group>
														 <Radio value="1">商城礼品</Radio> */}
														<Radio value="2">优惠券</Radio>
														<Radio value="3">现金红包</Radio>
														<Radio value="4">积分</Radio>
														<Radio value="0">自定义</Radio>
													</Radio.Group>
												)}
											</FormItem>
										</Col>
										{gamePrizeSetDetail.awardType == '1' &&
											<Col span={12}>
												<FormItem {...formItemLayout} label="礼品名称">
													{getFieldDecorator(`content[${index}].giftName`, {
														rules: [{
															required: gamePrizeSetDetail.awardType == '1' && tabKey=='3', whitespace: true, message: '请选择礼品'
														}],
														initialValue: gamePrizeSetDetail.giftName
													})(
														<Input style={{width:'78%',marginRight:'4px'}}
															disabled={true} 
															placeholder='请选择礼品'  />
													)}
													<Button type='primary' disabled={gamePrizeSetDetail.awardStock!=gamePrizeSetDetail.awardNumber} onClick={e => selGift(true)}>选择礼品</Button>
												</FormItem>
											</Col>
										}
										{gamePrizeSetDetail.awardType == '2' &&
											<Col span={12}>
												<FormItem {...formItemLayout} label="优惠券名称">
													{getFieldDecorator(`content[${index}].giftName`, {
														rules: [{
															required: gamePrizeSetDetail.awardType == '2' && tabKey=='3', whitespace: true, message: '请选择优惠券'
														}],
														initialValue: gamePrizeSetDetail.giftName
													})(
														<Input 
															disabled={true} style={{width:'74%',marginRight:'7px'}}
															placeholder='请选择优惠券'/>
													)}
													<Button disabled={gameStatus&&gameStatus=='edit'&&!pane.editable} type='primary' disabled={gamePrizeSetDetail.awardStock!=gamePrizeSetDetail.awardNumber} onClick={e => selDiscountCoupon(true)}>选择优惠券</Button>
												</FormItem>
											</Col>
										}
										{gamePrizeSetDetail.awardType == '3' &&
											<Col span={12}>
												<Row>
													<Col span={12}>
														<FormItem {...formItemLayout6} label="单个红包金额">
														{getFieldDecorator(`content[${index}].redAmount`, {
															rules: [
																{ required: gamePrizeSetDetail.awardType == '3' && tabKey=='3', message: '请输入红包金额' },
																{pattern:/^\d+(\.\d{0,2})?$|^\.\d{1,2}$/, message: '请输入的数字(支持2位小数)' }, 
															],
															initialValue: gamePrizeSetDetail.redAmount
														})(
															<Input disabled={gameStatus&&gameStatus=='edit'&&!pane.editable} placeholder='请输入红包金额' style={{width:'70%'}} onChange={(e) => { gamePrizeSetInputChange(e.target.value, 'redAmount') }}/>
														)}
														<span style={{fontSize:'12px'}}>元</span>
														</FormItem>
													</Col>
													<Col span={12}>
														<FormItem {...formItemLayout6} label="发放账号">
														{getFieldDecorator(`content[${index}].sendRedAccount`, {
															rules: [
																{ required: gamePrizeSetDetail.awardType == '3' && tabKey=='3', whitespace: true, message: '请选择发放账户' },
															],
															initialValue: gamePrizeSetDetail.sendRedAccount
														})(
															<Input disabled={gameStatus&&gameStatus=='edit'&&!pane.editable} placeholder='请填写发放账号' style={{width:'70%'}}  onChange={(e) => { gamePrizeSetInputChange(e.target.value, 'sendRedAccount') }} />
														)}
														</FormItem>
													</Col>
												</Row>
											</Col>
										}
										{gamePrizeSetDetail.awardType == '4' &&
											<Col span={12}>
												<FormItem {...formItemLayout} label="获得积分">
													{getFieldDecorator(`content[${index}].points`, {
														rules: [
															{ required: gamePrizeSetDetail.awardType == '4' && tabKey=='3', message: '请输入获得中奖积分数' },
															{ pattern: /^[0-9]\d*$/, message: '请输入正整数' }, 
														],
														initialValue: gamePrizeSetDetail.points
													})(
														<Input disabled={gameStatus&&gameStatus=='edit'&&!pane.editable} style={{width:'74%'}} placeholder='请输入获得中奖积分数' onChange={(e) => { gamePrizeSetInputChange(e.target.value, 'points') }} />
													)}
												</FormItem>
											</Col>
										}
									</Row>
									<Row>
										<Col span={12}>
											<FormItem {...formItemLayout} label="奖品名称">
												{getFieldDecorator(`content[${index}].awardName`, {
													rules: [{
														required: tabKey=='3', whitespace: true, message: '请输入奖品名称'
													}],
													initialValue: gamePrizeSetDetail.awardName ? gamePrizeSetDetail.awardName + '' : ''
												})(
													<Input maxLength="8"
														placeholder='请输入不超过8个字的奖品名称' disabled={gameStatus&&gameStatus=='edit'&&!pane.editable} onChange={(e) => { gamePrizeSetInputChange(e.target.value, 'awardName') }} />
												)}
											</FormItem>
										</Col>

										<Col span={12}>
											<FormItem
												{...formItemLayout4}
												extra="图片尺寸：720px*480 px，文件大小:200kb，备注：需要传png格式图片，否则影响展示效果"
												label="奖品小图"
												required={tabKey=='3'}
											>
												<div className={cx('uploaderBox')}>
													<div className={cx('uploaderDiv')}>
														<Uploader 
															className={cx('uploadDiv')}
															uploadedUrls={gamePrizeSetDetail.awardImgUrl}
															removeFileCbf={(index) => { removePrizeImgUrl(index,'awardImgUrl') }}
															uploadSuccessCbf={(imgUrl) => {
																updatePrizeImageModel(imgUrl, 'awardImgUrl')
															}}
															// showType={actionType == 'detail'?'4':"3"}
															showType='2'
															minCropBoxWidth={720}
															minCropBoxHeight={480}
															disabled={gameStatus&&gameStatus=='edit'&&!pane.editable}
															imgStatus={gameStatus?gameStatus:''}
															// unsetWidth={true}
															fileType='image'
															fileMaxSize='0.2'
															maxFiles='1'
														/>
													</div>
												</div>
											</FormItem>
										</Col>
									</Row>

									<Row>
										<Col span={12}>
											<FormItem label='奖品总库存'  {...formItemLayout}>
												{getFieldDecorator(`content[${index}].awardNumber`, {
													rules: [
														{ required: tabKey=='3', whitespace: true, message: '请输入奖品总库存'},
														{ pattern: /^[0-9]\d*$/, message: '请输入正整数' }, 
													],
													initialValue: gamePrizeSetDetail.awardNumber ? gamePrizeSetDetail.awardNumber+"" : ""
												})(
													<Input placeholder='请输入奖品总库存' onChange={(e) => {gamePrizeSetInputChange(e.target.value, 'awardNumber') }} />
												)}
											</FormItem>
										</Col>
										<Col span={12}>
											<FormItem label='奖品剩余库存'  {...formItemLayout}>
												{getFieldDecorator(`content[${index}].awardStock`, {
													rules: [
														{ required: false, whitespace: true, message: ''},
													],
													initialValue: gamePrizeSetDetail.awardStock ? gamePrizeSetDetail.awardStock+"" : ""
												})(
													<Input disabled={true}/>
												)}
											</FormItem>
										</Col>
									</Row>
									<Row>
										<Col span={12}>
											<FormItem {...formItemLayout4} label="中奖人群">
												{getFieldDecorator(`content[${index}].awardGamePlayerType`, {
													initialValue: gamePrizeSetDetail.awardGamePlayerType,
													rules: [
														{ required:tabKey=='3', whitespace: true, message: '请选择指定中奖人群' , type: 'string'},
													],
												})(
													<Radio.Group onChange={(e) => gamePrizeSetInputChange(e.target.value, 'awardGamePlayerType')}>
														<Radio value='1'>所有城市玩家</Radio>
														<Radio value='2'>基础设置中发布活动范围的用户才有机会获奖</Radio>
														{!gameBaseDetail.promoteStatus &&
															<Radio value='3'>用户定位在有美的项目的城市才有机会获奖</Radio>
														}
														</Radio.Group>
												)}
											</FormItem>
										</Col>
										<Col span={12}>
											<FormItem label='此奖在所有奖品的中奖概率'  {...formItemLayout3}>
												{getFieldDecorator(`content[${index}].winningRate`, {
													rules: [// pattern: /^(\d|[0-9]\d|100)(\.\d{1,2})?$/,
														{ required: false, whitespace: true, message: '请输入中奖概率'},
														{pattern:/^(\d|[0-9]\d|100)(\.\d{1,2})?$/, message: '请输入0-100的数字(支持2位小数)' }, 
													],
													initialValue: gamePrizeSetDetail.winningRate ? gamePrizeSetDetail.winningRate+"" : "0"
												})(
													<Input style={{width:'87%'}} placeholder='请输入中奖概率'
													onChange={(e) => { gamePrizeSetInputChange(e.target.value, 'winningRate') }} />
												)}
												<span>%</span>
												<Tooltip title="说明：如果用户获得中奖资格，中得此奖品的概率，所有奖项概率加起来为100%。"><Icon type="question-circle" className={cx('iconTip')} /></Tooltip>
											</FormItem>
										</Col>
									</Row>
									<Row>
										<Col span={12}>
											<FormItem {...formItemLayout4} label="是否安慰奖">
												{getFieldDecorator(`content[${index}].consolationAward`, {
													initialValue: gamePrizeSetDetail.consolationAward,
												})(
													<Radio.Group onChange={(e) => gamePrizeSetInputChange(e.target.value, 'consolationAward')}>
														<Radio value='1'>是</Radio>
														<Radio value='0'>否</Radio>
													</Radio.Group>
												)}
												{/* <Tooltip title="仅有一个奖项设置为安慰奖,其他均自动修改为'否'。"><Icon type="question-circle" className={cx('iconTip')} /></Tooltip> */}
											</FormItem>
										</Col>
									</Row>
								</CollapsiblePanels>
								
								<CollapsiblePanels title={'兑奖方式'} hideUpDownBtn={true}>
									<Row>
										<Col span={12}>
											<FormItem {...formItemLayout4} label="兑奖方式" >
												{getFieldDecorator(`content[${index}].rewardWay`, {
													initialValue: gamePrizeSetDetail.rewardWay ? gamePrizeSetDetail.rewardWay : (gamePrizeSetDetail.awardType == '3' || gamePrizeSetDetail.awardType == '' ? '4' : '1'),
													rules: [
														{ required: tabKey=='3', whitespace: true, message: '请选择兑奖方式', type: 'string' },
													],
												})(
													<Radio.Group disabled={gamePrizeSetDetail.awardType == 2} onChange={(e) => gamePrizeSetInputChange(e.target.value, 'rewardWay')}>
														<Radio value='1'>项目现场兑奖</Radio>
														<Radio value='2'>邮寄方式兑奖</Radio>
														{/* <Radio value='3'>客服兑奖</Radio> */}
														<Radio value='4'>系统自动发放</Radio>
													</Radio.Group>
												)}
											</FormItem>
										</Col>
									</Row>
									{gamePrizeSetDetail.rewardWay == '3' && 
										<Col span={12}>
											<FormItem {...formItemLayout} label="兑奖人员">
												{getFieldDecorator(`content[${index}].redeemUserNames`, {
													rules: [{
														required: gamePrizeSetDetail.rewardWay == '3' && tabKey=='3', whitespace: true, message: '请选择兑奖人员'
													}],
													initialValue: gamePrizeSetDetail.redeemUserNames ? gamePrizeSetDetail.redeemUserNames + '' : ''
												})(
													<Input 
														disabled={true} style={{width:'71%',marginRight:'7px'}}
														placeholder='请选择兑奖人员' />
												)}
												<Button type='primary' onClick={e => selCounselor(true)}>选择兑奖人员</Button>
											</FormItem>
										</Col>
									}
									<Row>
										<Col span={12}>
											<FormItem label='兑奖提示'  {...formItemLayout}>
												{getFieldDecorator(`content[${index}].operationHint`, {
													rules: [{
														required: tabKey=='3', whitespace: true, message: '请输入兑奖提示，最多20个字'
													},
													{pattern:/^.{0,20}$/, message: '请输入兑奖提示，最多20个字' },
													],
													initialValue: gamePrizeSetDetail.operationHint ? gamePrizeSetDetail.operationHint + '' : undefined
												})(
													<Input
														// disabled={actionType == 'detail'}
														placeholder='请输入兑奖提示，最多20个字' onChange={(e) => { gamePrizeSetInputChange(e.target.value, 'operationHint') }} />
												)}
											</FormItem>
										</Col>
									</Row>
									{gamePrizeSetDetail.rewardWay == '1' && 
										<Row>
										<Col span={12}>
											<FormItem {...formItemLayout4} label="兑奖期限">
												{getFieldDecorator(`content[${index}].durationType`, {
													initialValue: gamePrizeSetDetail.durationType,
													rules: [
														{ required: tabKey=='3' && gamePrizeSetDetail.rewardWay != '2', whitespace: true, message: '请选择兑奖期限方式', type: 'string' },
													],
												})(
													<Radio.Group onChange={(e) => gamePrizeSetInputChange(e.target.value, 'durationType')}>
														<Radio value='1'>固定期限</Radio>
														{/* <Radio value='2'>固定时间</Radio> */}
													</Radio.Group>
												)}
											</FormItem>
										</Col>
										{gamePrizeSetDetail.durationType == '1' && 
											<Col span={10}>
												<FormItem
													{...formItemLayoutTime}
													label="兑奖限期"
												// extra="注：同一时间，如果美的置业云首页有集团设置的弹窗广告，将只会显示集团设置的弹窗广告,生效时间最长设置时间为15天"
												>
													{getFieldDecorator(`content[${index}].redeemTime`, {
														rules: [{ required: gamePrizeSetDetail.durationType == '1' && tabKey=='3', message: '请选择兑奖限期' },
														],
														initialValue: gamePrizeSetDetail.startTime ? [moment(gamePrizeSetDetail.startTime, 'YYYY-MM-DD HH:mm:ss'), moment(gamePrizeSetDetail.endTime, 'YYYY-MM-DD HH:mm:ss')] : [],
													})(
			
														<RangePicker
															style={{ width: "100%" }}
															showTime={{
																hideDisabledOptions: true,
																defaultValue: [moment(null, 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],
			
															}}
															format="YYYY-MM-DD HH:mm:ss" onChange={(date, dateString) => { gamePrizeSetDateChange(date, dateString, 'redeemTime') }}
														/>
			
													)}
												</FormItem>
											</Col>
										}
										{/* {gamePrizeSetDetail.durationType == '2' && 
											<Col span={10}>
												<FormItem
													{...formItemLayoutTime}
													label="兑奖日期"
												// extra="注：同一时间，如果美的置业云首页有集团设置的弹窗广告，将只会显示集团设置的弹窗广告,生效时间最长设置时间为15天"
												>
													{getFieldDecorator('duration', {
														rules: [{ required: gamePrizeSetDetail.durationType == '2' && tabKey=='3', message: '请选择兑奖日期' },
														],
														initialValue: gamePrizeSetDetail.duration ? moment(gamePrizeSetDetail.duration, 'YYYY-MM-DD HH:mm:ss'): '',
													})(
														<DatePicker
															style={{ width: "100%" }}
															showTime={{
																hideDisabledOptions: true,
																defaultValue: moment(null, 'HH:mm:ss'),
			
															}}
															format="YYYY-MM-DD HH:mm:ss" onChange={(date, dateString) => { gamePrizeSetDateChange(date, dateString, 'duration') }}
														/>
			
													)}
												</FormItem>
											</Col>
										} */}
									</Row>
									}
									{gamePrizeSetDetail.rewardWay == '1' && gameBaseDetail.promoteStatus && 
										<Row>
											<Col span={24}>
												<FormItem label='楼盘地址'  {...formItemLayoutForTime}>
													<InputGroup compact>
														<Cascader style={{ width: '25%' }}
															options={areaList} disabled={true}
															value={[`${gameBaseDetail.province}`, `${gameBaseDetail.city}`]} placeholder="请选择所属城市" />
														<Select style={{ width: '25%' }} notFoundContent={'该省市中无楼盘'}
															value={gameBaseDetail.productId} disabled={true} placeholder="请选择项目">
															{
																estateList && estateList.map((item, index) => (
																	<Select.Option key={`house_${index}`} value={item.productId}>{item.name}</Select.Option>
																))
															}
														</Select>
														<Input disabled={true} value={mapAddress} style={{width:'50%'}}/>
													</InputGroup>
												</FormItem>
											</Col>
										</Row>
									}
								</CollapsiblePanels>
								{ gamePrizeSetDetail.rewardWay == '1' && !gameBaseDetail.promoteStatus && 
									<CollapsiblePanels title="兑奖地址" hideUpDownBtn={true} >
										<PopUpSelect
											tableColumn={sellerTableColumn}
											selectedColumn={sellerSelectedColumn}
											selectedTableScroll={{ x: 420 }}
											queryList={cloneDeep(sellerQueryList)}
											isSave={true}
											refreshByEnter={true}
											requestUrl='admin/estate/adminList'
											title='选择工程名称'
											respListKey='rows'
											idKey='productId'
											onItem={gamePrizeSetDetail.estateAddress}
											onChange={(e) => {
												// let productIds=[]
												let estateAddress = [];
												e.map((item)=>{
													// productIds.push(item.productId);
													let p = {
														mapAddress:item.mapAddress,
														province:item.province,
														provinceName:item.provinceName,
														productName:item.name && item.name!=""?item.name:item.productName,
														latitude:item.latitude,
														longitude:item.longitude,
														cityName:item.cityName,
														city:item.city,
														productId:item.productId,
														projectId:item.outerId||item.projectId,
														estatePhone:item.estatePhone
													};
													estateAddress.push(p);
												})
												gamePrizeSetDetail.estateAddress = estateAddress;
												if(gamePrizeSetDetailList.length > 0){
													gamePrizeSetDetailList[prizeTabIndex-1].estateAddress = estateAddress;
													// for(let i=0;i<gamePrizeSetDetailList.length;i++){
													// 	gamePrizeSetDetailList[i] = gamePrizeSetDetail;
													// }
												}
												// projectData.productIds=Array.from(new Set(productIds))
												dispatch({
													type: `${namespace}/updateStore`,
													payload: {gamePrizeSetDetail,gamePrizeSetDetailList}
												})
											}}
										></PopUpSelect>
									</CollapsiblePanels>
								}
							</div>
						</Form>

						<Modal
							visible={giftModalObj.giftVisible}
							onOk={() => confirmGiftData()}
							onCancel={() => {
								selGift(false)
							}}
							width={'80%'}
						>
							<ListPage pageProps={giftPageProps} />
						</Modal>	
						<Modal
							visible={giftModalObj.discountCouponVisible}
							onOk={() => confirmDiscountCouponData()}
							onCancel={() => {
								selDiscountCoupon(false)
							}}
							width={'80%'}
						>
							<ListPage pageProps={discountCouponPageProps} />
						</Modal>	

						<Modal
							visible={counselorModalObj.counselorVisible}
							onOk={() => confirmCounselorData()}
							onCancel={() => {
								selCounselor(false)
							}}
							width={'80%'}
						>
							<ListPage pageProps={counselorPageProps} />
						</Modal>		
					</TabPane>
					))}
				</Tabs>
			</div>
		</div>
            </TabPane>
            <TabPane tab="高级设置" key="4" >
            <div className={cx('pageLayout')}>
			<div className='public_listMain'>
				<Form>
					<div className="boxShadow">
						<CollapsiblePanels title={'企业信息'} hideUpDownBtn={true}>
							<Row>
                                <Col span={12}>
									<FormItem label='主办单位'  {...formItemLayout}>
										{getFieldDecorator('sponsorUnit', {
											rules: [{
												required: tabKey=='4', whitespace: true, message: '请输入主办单位'
											}],
											initialValue: gameHighSetDetail.sponsorUnit ? gameHighSetDetail.sponsorUnit + '' : ''
										})(
											<Input disabled={gameBaseDetail.launchApp == "2"}
												placeholder='请输入主办单位' onChange={(e) => { gameHighSetInputChange(e.target.value, 'sponsorUnit') }} />
										)}
									</FormItem>
								</Col>
                                
                            </Row>
						</CollapsiblePanels>
						<CollapsiblePanels title={'分享设置'} hideUpDownBtn={true}>
							<Row>
								<Col span={12}>
									<FormItem label='分享好友及群聊'  {...formItemLayout5}>
										{getFieldDecorator('allowSharing', {
											initialValue: gameHighSetDetail.allowSharing,
											rules: [
												{ required: tabKey=='4', whitespace: false, type: 'string' },
											],
										})(
											<Radio.Group disabled={gameBaseDetail.launchApp == "2"} onChange={(e) => gameHighSetInputChange(e.target.value, 'allowSharing')}>
												<Radio value='0'>关闭分享</Radio>
												<Radio value='1'>开启分享</Radio>
											</Radio.Group>
										)}
									</FormItem>
								</Col>
							</Row>
							{gameHighSetDetail.allowSharing=='1' &&
							<Row>
								<Col span={12}>
									<FormItem label='分享标题'  {...formItemLayout}>
										{getFieldDecorator('sharingTitle', {
											rules: [
												{
												required: gameHighSetDetail.allowSharing=='1' && tabKey=='4',whitespace: true, message: '请输入分享描述，最多24个字'
												},
												{pattern:/^.{0,24}$/, message: '请输入分享描述，最多24个字' },
											],
											initialValue: gameHighSetDetail.sharingTitle ? gameHighSetDetail.sharingTitle + '' : ''
										})(
											<Input
												disabled={gameHighSetDetail.allowSharing=='0'}
												placeholder='请输入分享标题' onChange={(e) => { gameHighSetInputChange(e.target.value, 'sharingTitle') }} />
										)}
									</FormItem>
								</Col>
								
							</Row>
							}
							{gameHighSetDetail.allowSharing=='1' &&
								<Row>
									<Col span={12}>
										<FormItem
											{...formItemLayout}
											extra="图片分辨率需为1500px*1136px，且文件大小在200kb以下，支持jpg，png格式。"
											label="分享图片"
											required={gameHighSetDetail.allowSharing=='1' && tabKey=='4'}
										>
											<div className={cx('uploaderBox')}>
												<div className={cx('uploaderDiv')}>
													<Uploader
														disabled={!gameHighSetDetail.allowSharing}
														uploadedUrls={gameHighSetDetail.sharingImgUrl}
														removeFileCbf={() => { removeImgUrl('sharingImgUrl') }}
														uploadSuccessCbf={(imgUrl) => {
															updateImageModel(imgUrl, 'sharingImgUrl')
														}}
														// showType={actionType == 'detail'?'4':"3"}
														showType='2'
														minCropBoxWidth={1500}
														minCropBoxHeight={1136}
														// unsetWidth={true}
														fileType='image'
														fileMaxSize='0.2'
														maxFiles='1'
													/>
												</div>
											</div>
										</FormItem>
									</Col>
								</Row>
							}
							
							{gameType != '1' && <Row>
								<Col span={12}>
									<FormItem label='分享海报'  {...formItemLayout}>
										{getFieldDecorator('sharingPosterShow', {
											initialValue: gameHighSetDetail.sharingPosterShow,
											rules: [
												{ required: tabKey=='4', whitespace: true, message: '请选择分享海报' },
											],
										})(
											<Radio.Group disabled={gameBaseDetail.launchApp == "2"} onChange={(e) => gameHighSetInputChange(e.target.value, 'sharingPosterShow')}>
												<Radio value='0'>关闭分享</Radio>
												<Radio value='1'>开启分享</Radio>
											</Radio.Group>
										)}
									</FormItem>
								</Col>
							</Row>}
							{gameType != '1' && gameHighSetDetail.sharingPosterShow=='1' && 
								<Row>
									<Col span={12}>
										<FormItem
											{...formItemLayout}
											extra="图片分辨率需为1500px*2668px，且文件大小在200kb以下，支持jpg，png格式。"
											label="分享图片"
											required={gameHighSetDetail.sharingPosterShow=='1' && tabKey=='4'}
										>
											<div className={cx('uploaderBox')}>
												<div className={cx('uploaderDiv')}>
													<Uploader
														disabled={gameHighSetDetail.sharingPosterShow=='0'}
														uploadedUrls={gameHighSetDetail.posterImgUrl}
														removeFileCbf={() => { removeImgUrl('posterImgUrl') }}
														uploadSuccessCbf={(imgUrl) => {
															updateImageModel(imgUrl, 'posterImgUrl')
														}}
														// showType={actionType == 'detail'?'4':"3"}
														showType='2'
														minCropBoxWidth={1500}
														minCropBoxHeight={2668}
														// unsetWidth={true}
														fileType='image'
														fileMaxSize='0.2'
														maxFiles='1'
													/>
												</div>
											</div>
										</FormItem>
									</Col>
								</Row>
							}
						</CollapsiblePanels>

						{(gameHighSetDetail.allowSharing==1 || gameHighSetDetail.sharingPosterShow == 1) &&
						<CollapsiblePanels title={'助力设置'} hideUpDownBtn={true}>
							<Row>
                                <Col span={24}>
									<FormItem label='助力设置'  {...formItemLayoutForTime}>
										{getFieldDecorator('assistedOpening', {
											initialValue: gameHighSetDetail.assistedOpening,
											rules: [
												{ required: tabKey=='4', whitespace: true, message: '请选择助力设置', type: 'string' },
											],
										})(
											<Radio.Group style={{width:'150px'}} onChange={(e) => gameHighSetInputChange(e.target.value, 'assistedOpening')}>
												<Radio value='0'>关闭</Radio>
												<Radio value='1'>开启</Radio>
											</Radio.Group>
										)}
										{getFieldDecorator('assistanceForce', {
											rules: [
												// { required: (gameHighSetDetail.assistedOpening=='1' || gameHighSetDetail.assistedOpening==1 ) && tabKey=='4' ,whitespace: true, message: '请输入助力人数'},
												// { pattern: /^[1-9]\d*$/, message: '请输入整数' },
											],
											initialValue: gameHighSetDetail.assistanceForce ? gameHighSetDetail.assistanceForce+"" : ""
										})(
											<Input disabled={gameHighSetDetail.assistedOpening=='0'} placeholder='请输入助力人数' style={{margin:'0 10px',width:'120px'}} onChange={(e) => { gameHighSetInputChange(e.target.value, 'assistanceForce') }} />
										)}
										<span style={{fontSize:'12px'}}>人助力增加1次抽奖机会</span>
									</FormItem>
								</Col>
                            </Row>
							<Row>
								<Col span={12}>
									<FormItem label='助力邀请语'  {...formItemLayout4}>
										{getFieldDecorator('helpInvitation', {
											rules: [
												{required: (gameHighSetDetail.assistedOpening=='1' || gameHighSetDetail.assistedOpening==1) && tabKey=='4', whitespace: true, message: '请输入助力邀请语,最多40个字'},
												{pattern:/^.{0,40}$/, message: '请输入助力邀请语,最多40个字' },
											], 
											initialValue: gameHighSetDetail.helpInvitation ? gameHighSetDetail.helpInvitation + '' : '好友{name}急需您的助力，请为ta助力'
										})(
											<Input
												disabled={gameHighSetDetail.assistedOpening=='0'} style={{width:'90%'}}
												placeholder='请输入助力邀请语,最多40个字' onChange={(e) => { gameHighSetInputChange(e.target.value, 'helpInvitation') }} />
										)}
										<Tooltip title="说明：好友识别海报或者点击分享后，弹窗的助力邀请语，非海报上的邀请语。"><Icon type="question-circle" className={cx('iconTip')} /></Tooltip>
									</FormItem>
								</Col>
							</Row>
						</CollapsiblePanels>}
					</div>
				</Form>


			</div>
		</div>
            </TabPane>
        </Tabs>
		</div>
	</div>	
    )
}
// 连接视图(view)和模型(model)
export default connect(mapStateToProps)(Form.create()(gameParamsTabView))